Skip to content

Commit 261e7de

Browse files
committed
Security non-standard html content as html
Attached html files are not shipped as text/html by default, unless ``allow_html_file`` is specified in the configuration. Unfortunately some browsers want to be helpful and render other non-standard content types as html. We now change this to application/octet-stream whenever 'html' is contained in the string (case insensitive). Thanks to Kay Hayen for reporting and helping debug this.
1 parent f8ec208 commit 261e7de

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

CHANGES.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,13 @@ Fixed:
114114
include the email addresses, depending on your installation you may
115115
want to further restrict this or add some attributes like ``address``
116116
and ``alternate_addresses``. (Ralf Schlatterbeck)
117+
- Security: Attached html files are not shipped as text/html by default,
118+
unless ``allow_html_file`` is specified in the configuration.
119+
Unfortunately some browsers want to be helpful and render other
120+
non-standard content types as html. We now change this to
121+
application/octet-stream whenever 'html' is contained in the string
122+
(case insensitive). Thanks to Kay Hayen for reporting and helping
123+
debug this. (Ralf Schlatterbeck)
117124

118125
Minor:
119126
- demo.py usage message improved: explains "nuke" now. (Bernhard Reiter)

roundup/cgi/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -977,7 +977,7 @@ def serve_file(self, designator, dre=re.compile(r'([^\d]+)(\d+)')):
977977

978978
# if the mime_type is HTML-ish then make sure we're allowed to serve up
979979
# HTML-ish content
980-
if mime_type in ('text/html', 'text/x-html'):
980+
if 'html' in str (mime_type).lower () :
981981
if not self.instance.config['WEB_ALLOW_HTML_FILE']:
982982
# do NOT serve the content up as HTML
983983
mime_type = 'application/octet-stream'

0 commit comments

Comments
 (0)