Files @ aa51aca7fd1a
Branch filter:

Location: kallithea/pytype_requirements.txt

Valentin Kleibel
controller: Handle UnicodeDecodeError from webob decoding invalid URLs

webob will try to utf-8 decode all %-encoded bytes in URL-parameters, but will
not handle Unicode erors ... and neither did Kallithea. Visiting a URL like
http://localhost:5000/?%AD would thus give an unhandled exception showing
"Internal Server Error" to the user, and logging the full traceback and:

WebApp Error: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xad in position 0: invalid start byte

This has been seen a lot recently from attackers probing for a php
vulnerability
https://devco.re/blog/2024/06/06/security-alert-cve-2024-4577-php-cgi-argument-injection-vulnerability-en/ .

Now handle these exceptions more nicely and reject with "400 Bad Request".
1
2
3
4
5
6
7
8
9
# Note: we support pytype on Python3.9
pytype==2021.4.1
# optional modules that we want for pytype checking
ipython
kajiki
psycopg2
python-ldap
python-pam
tgext.debugbar