Skip to content

Commit fa2593d

Browse files
committed
Allows underscores in URL hosts
Underscore is a valid character in the host portion of a URL but the simply URL validation regex does not currently support it. Ideally this would be using `urllib` or `urlparse` but since that module changed from 2 to 3 the simple fix is to just update the regex.
1 parent c45c0f8 commit fa2593d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/onelogin/saml2/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
# Released under a BSD 3-Clause License
3434
url_regex = re.compile(
3535
r'^(?:[a-z0-9\.\-]*)://' # scheme is validated separately
36-
r'(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+(?:[A-Z]{2,6}\.?|[A-Z0-9-]{2,}\.?)|' # domain...
36+
r'(?:(?:[A-Z0-9_](?:[A-Z0-9-_]{0,61}[A-Z0-9_])?\.)+(?:[A-Z]{2,6}\.?|[A-Z0-9-]{2,}\.?)|' # domain...
3737
r'localhost|' # localhost...
3838
r'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|' # ...or ipv4
3939
r'\[?[A-F0-9]*:[A-F0-9:]+\]?)' # ...or ipv6

0 commit comments

Comments
 (0)