Repository navigation
feat(vercel): Rate limit extra API authentication per org - #127459
Conversation
getsentry's Vercel build tokens are only recognized by DRF, so AuthenticationMiddleware treated them as anonymous and rate limiting keyed them by IP. The middleware now tries SENTRY_EXTRA_API_AUTHENTICATION first, and get_rate_limit_key uses the token's org when there's no ApiToken row behind it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit a624ee1. Configure here.
| AgentTokenAuthentication, | ||
| ApiKeyAuthentication, | ||
| ): | ||
| for authenticator_class in TOKEN_AUTHENTICATION: |
There was a problem hiding this comment.
Middleware stops on extra-auth None
High Severity
The middleware returns after the first authenticator whose accepts_auth is true and treats a None result as anonymous. Extra API authenticators are documented to return None for unrecognized credentials so later classes can run. Regular Bearer tokens can then be rate-limited by IP instead of by user or org.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit a624ee1. Configure here.
There was a problem hiding this comment.
Not an issue here: getsentry’s class only accepts JWTs from Vercel’s issuer in accepts_auth, so other bearer tokens still reach UserAuthTokenAuthentication.
`AuthenticationMiddleware` doesn't know about `SENTRY_EXTRA_API_AUTHENTICATION` (#127086), so getsentry's Vercel build tokens get rate limited per IP instead of per org like the token they replace. The middleware now tries those classes first, and `get_rate_limit_key` uses the token's org when there's no `ApiToken` row. No change without getsentry, tested end to end in getsentry/getsentry#22522. refs https://linear.app/getsentry/issue/IE-89/rate-limit-vercel-build-tokens-per-org-not-per-ip Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>


AuthenticationMiddlewaredoesn't know aboutSENTRY_EXTRA_API_AUTHENTICATION(#127086), so getsentry's Vercel build tokens get rate limited per IP instead of per org like the token they replace.The middleware now tries those classes first, and
get_rate_limit_keyuses the token's org when there's noApiTokenrow. No change without getsentry, tested end to end in getsentry/getsentry#22522.refs https://linear.app/getsentry/issue/IE-89/rate-limit-vercel-build-tokens-per-org-not-per-ip