-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
YDA-5890: restrict redirects on login
Permit only redirects to relative URLs. Check both at time the URL is passed and when the redirect is performed to make this more robust against future changes in login logic.
- Loading branch information
Showing
3 changed files
with
25 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ | |
get_theme_directories, | ||
get_validated_static_path, | ||
is_email_in_domains, | ||
is_relative_url, | ||
length_check, | ||
unicode_secure_filename, | ||
) | ||
|
@@ -237,3 +238,11 @@ def test_get_theme_directories_only_files(self) -> None: | |
expected_result = ['uu'] | ||
result = get_theme_directories('/test/path') | ||
assert result == expected_result | ||
|
||
def test_is_relative_url(self) -> None: | ||
self.assertEqual(is_relative_url("http://www.uu.nl"), False) | ||
self.assertEqual(is_relative_url("https://www.uu.nl"), False) | ||
self.assertEqual(is_relative_url("http://username:[email protected]"), False) | ||
self.assertEqual(is_relative_url("https://username:[email protected]"), False) | ||
self.assertEqual(is_relative_url("/foo/bar/bat"), True) | ||
self.assertEqual(is_relative_url("foo/bar/bat"), True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters