Skip to content

Commit a2edc3c

Browse files
committed
Fix fix XSS issue in wsgi and cgi when handing url not found/404. issue2551035
1 parent 911b890 commit a2edc3c

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

CHANGES.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ Fixed:
100100
HTTP_X-REQUESTED-WITH to HTTP_X_REQUESTED_WITH. The last is
101101
correct. Also fix roundup-server to produce the latter form. (Patch
102102
by C�dric Krier, reviewed/applied John Rouillard.)
103+
- issue2551035 - fix XSS issue in wsgi and cgi when handing url not
104+
found/404. Reported by hannob at
105+
https://github.com/python/bugs.python.org/issues/34, issue opened by
106+
JulienPalard.
103107

104108
2018-07-13 1.6.0
105109

frontends/roundup.cgi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ def main(out, err):
181181
request.send_response(404)
182182
request.send_header('Content-Type', 'text/html')
183183
request.end_headers()
184-
out.write(s2b('Not found: %s'%client.path))
184+
out.write(s2b('Not found: %s'%cgi.escape(client.path)))
185185

186186
else:
187187
from roundup.anypy import urllib_

roundup/cgi/wsgi_handler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def __call__(self, environ, start_response):
6969
client.main()
7070
except roundup.cgi.client.NotFound:
7171
request.start_response([('Content-Type', 'text/html')], 404)
72-
request.wfile.write(s2b('Not found: %s'%client.path))
72+
request.wfile.write(s2b('Not found: %s'%cgi.escape(client.path)))
7373

7474
# all body data has been written using wfile
7575
return []

0 commit comments

Comments
 (0)