Skip to content

Commit c799aab

Browse files
add allowlist
1 parent 5cbb25f commit c799aab

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/sentry/api/authentication.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -443,9 +443,11 @@ def authenticate_token(self, request: Request, token_str: str) -> tuple[Any, Any
443443
raise AuthenticationFailed("Unauthorized organization access.")
444444
else:
445445
# We want to limit org scoped tokens access to org level endpoints only
446-
raise AuthenticationFailed(
447-
"This token access is limited to organization endpoints."
448-
)
446+
# Or none org level endpoints that we added special treatments for
447+
if resolved_url.url_name not in ["sentry-api-0-organizations"]:
448+
raise AuthenticationFailed(
449+
"This token access is limited to organization endpoints."
450+
)
449451
else:
450452
sentry_sdk.capture_message(
451453
"Could not resolve organization for organization scoped token", level="warning"

0 commit comments

Comments
 (0)