GLM-5.3 · Heavy
github-oauth-security-enhancement-sentry
Sentry · Python · M · 100–299 lines · 2 files
The generalist plus 9 specialist lens agents in parallel, then the same verify and dedup steps. Judge: Claude Haiku 5.5.
- Gold bugs found
- 1 of 1
- Comments published
- 4
- Comments matching a bug
- 1
- Comments not matching
- 3
- Cost of this PR
- $2.607
Published comments (4)
OAuth state is a constant signature, not a per-session nonce; forgeable callback — `pipeline.signature` is the same public constant for every session (md5 of view class names in `src/sentry/pipeline/base.py`), so an attacker can forge a callback and bind their GitHub identity to a victim's install. Generate a per-session `state` with `secrets.token_hex()`, persist it via `pipeline.bind_state("state", state)`, and compare with `pipeline.fetch_state("state")`.
Unguarded access to integration.metadata["sender"]["login"] raises KeyError — `ensure_integration` overwrites `metadata` on pipeline finish and the pipeline path never sets `sender`, so this read crashes the installation page with a 500. Read it as `integration.metadata.get("sender", {}).get("login")` and fail closed on a missing sender, as `src/sentry/integrations/github/installation.py` does.
Unhandled exception in OAuthLoginView when GitHub get_user_info fails — `get_user_info` raises on non-2xx (`raise_for_status` in `src/sentry/identity/github/provider.py`), so a degraded GitHub API or rejected token crashes with a 500 instead of the error page. Wrap the call in a try/except, like the token-exchange parsing above, and return `error(request, self.active_organization)` on failure.
test_installation_not_found no longer tests installation-not-found behavior — The hardcoded `state` never matches `pipeline.signature`, so the request fails at the state check before the not-found branch; the generic assertion keeps the test green even if that handling is removed. Capture the real state from the redirect's `Location` and assert "The GitHub installation could not be found."
Gold bugs found (1)
Gold bugs missed (0)
None.