Skip to content

Commit b469535

Browse files
committed
Update authority.py
updated the checking on host checking
1 parent 4015bf6 commit b469535

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

msal/authority.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,9 +237,12 @@ def has_valid_issuer(self):
237237

238238
# Case 3: Regional variant check - O(1) lookup
239239
# e.g., westus2.login.microsoft.com -> extract "login.microsoft.com"
240-
if any(issuer_host.endswith("." + trusted) for trusted in TRUSTED_ISSUER_HOSTS):
241-
return True
242-
240+
dot_index = issuer_host.find(".")
241+
if dot_index > 0:
242+
potential_base = issuer_host[dot_index + 1:]
243+
if potential_base in TRUSTED_ISSUER_HOSTS and "." not in issuer_host[:dot_index]:
244+
return True
245+
243246
# Case 4: Same scheme and host (path can differ)
244247
if (authority_parsed.scheme == issuer_parsed.scheme and
245248
authority_parsed.netloc == issuer_parsed.netloc):

0 commit comments

Comments
 (0)