Claude Sonnet 5.5 · Balanced

github-oauth-security-enhancement-sentry

Sentry · Python · M · 100–299 lines · 2 files

The normal review, with one generalist agent. Judge: Claude Haiku 5.5.

Gold bugs found
0 of 1
Comments published
4
Comments matching a bug
0
Comments not matching
4
Cost of this PR
$0.497

Published comments (4)

highsecuritysrc/sentry/integrations/github/integration.py:401-413

OAuth `state` is the constant `pipeline.signature`, giving no CSRF protection — Because `pipeline.signature` is identical for every user and session, an attacker can send a victim a setup URL with the attacker's own `code`, binding the attacker's login and defeating the new user-match check. Generate a random per-flow nonce, store it in the pipeline state, and compare against it instead of `pipeline.signature`.

highbugsrc/sentry/integrations/github/integration.py:501-504

KeyError when integration metadata lacks sender login — Existing integrations without `sender` metadata raise `KeyError` on `integration.metadata["sender"]["login"]`, returning a 500 instead of the error page. Use `.get("sender", {}).get("login")` and return `error(...)` when it is missing.

highsecuritysrc/sentry/integrations/github/integration.py:481-482

Installer verification skipped when no Integration row exists yet — When no `Integration` row exists yet, `pipeline.next_step()` runs without the user-match check, so racing the installation webhook bypasses verification. Fail closed in the `Integration.DoesNotExist` branch, or verify the installer through the GitHub API.

mediumbugsrc/sentry/integrations/github/integration.py:423-436

Network errors in GitHub OAuth token exchange and user lookup cause unhandled 500 — `safe_urlopen` and `get_user_info` run outside the try/except, so network errors, timeouts or `ApiError` from GitHub surface as an unhandled 500 mid-pipeline. Wrap both calls and return `error(request, self.active_organization)` on failure.

Gold bugs found (0)

None.

Gold bugs missed (1)

mediumtest_installation_not_found uses a wrong OAuth state, so it fails at the state check and never reaches the installation-not-found path it is meant to test.