Skip to content

Commit adc4d03

Browse files
committed
Prevent people from injecting // urls
Applications should handle this, but might not do so. Let's just protect against possible issues. Signed-off-by: Patrick Uiterwijk <patrick@puiterwijk.org>
1 parent 18d9c8a commit adc4d03

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

fedora/tg/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def url(tgpath, tgparams=None, **kwargs):
8181
'''
8282
if not isinstance(tgpath, six.string_types):
8383
tgpath = '/'.join(list(tgpath))
84-
if not tgpath.startswith('/'):
84+
if not tgpath.startswith('/') or tgpath.startswith('//'):
8585
# Do not allow the url() function to be used for external urls.
8686
# This function is primarily used in redirect() calls, so this prevents
8787
# covert redirects and thus CSRF leaking.

0 commit comments

Comments
 (0)