Skip to content

Commit af839b6

Browse files
committed
fix: fix possible HTTP Response Splitting in roundup-server
CodeQL flagged a possible HTTP Response Splitting in the Location header's URL. The AI suggested cleaning the Host value, except the URL also includes the query parameters in the URL so they could potentially trigger the issue. Th host header probably doesn;t have a newline or cr in it otherwise it wouldn't have been recognized by the server as a valid host. In any case strip all \n or \r from the url before use. Also update CHANGES.txt with fixing the gpg install.
1 parent 301fefe commit af839b6

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

CHANGES.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ Fixed:
9595
- issue2551406: 'Templating Error: too many values to unpack' crash
9696
fixed. (reported by and patch Christof Meerwald, commit/test John
9797
Rouillard)
98+
- fix potential HTTP Response Splitting issue in
99+
roundup-server. Discovered by CodeQL in CI. (John Rouillard)
98100

99101
Features:
100102

@@ -151,6 +153,8 @@ Features:
151153
Schlatterbeck)
152154
- issue2551231 - template.py-HTMLClass::classhelp doesn't merge
153155
user defined classes. It now merges them in. (John Rouillard)
156+
- re-enable support for GPG/PGP encrypted emails using new python gpg
157+
pakage on the test pypi instance. (Paul Schwabauer)
154158

155159
2024-07-13 2.4.0
156160

roundup/scripts/roundup_server.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,10 @@ def inner_run_cgi(self):
432432
url = '%s://%s%s/' % (protocol, self.headers['host'], rest)
433433
if query:
434434
url += '?' + query
435+
436+
# Do not allow literal \n or \r in URL to prevent
437+
# HTTP Response Splitting
438+
url = re.sub("[\r\n]", "", url)
435439
self.send_header('Location', url)
436440
self.send_header('Content-Length', 17)
437441
self.end_headers()

0 commit comments

Comments
 (0)