Claude Sonnet 5.5 · 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
5
Comments matching a bug
1
Comments not matching
4
Cost of this PR
$1.330

Published comments (5)

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

First-time GitHub installs skip authenticated-user verification — A first-time install with any `installation_id` skips the authenticated-user check, so the installation can be bound to the wrong user's session. Don't call `pipeline.next_step()` here without verifying that `github_authenticated_user` matches the installation's account or sender, or reject the request.

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

Token exchange and user-info lookup in GitHub OAuth step lack error handling — A network failure, timeout, or GitHub API error raises an unhandled exception and returns a 500 during installation. Move `safe_urlopen` into the try block and wrap `get_user_info` in try/except, returning `error(request, self.active_organization)` on failure.

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

OAuth state is a constant pipeline signature, not a per-flow secret — `pipeline.signature` is a constant, publicly derivable value, so the `state` check gives no CSRF or login-binding protection. Generate a random per-flow nonce, store it with `bind_state`, and compare it using `constant_time_compare` in the callback.

mediumbugtests/sentry/integrations/github/test_integration.py:388-396

test_installation_not_found uses wrong state and asserts only generic message — The test uses a `state` that differs from the pipeline signature in other tests, so it likely fails at the state check and never reaches the missing-installation branch. Use the correct state and assert on something specific to that case, since the generic message appears on every failure path.

mediumbugsrc/sentry/integrations/github/integration.py:501-505

KeyError on missing 'sender' in integration metadata causes 500 during install — `integration.metadata['sender']['login']` raises `KeyError` when `sender` is absent, since `build_integration` writes it only conditionally, so installation returns a 500 instead of the error page. Read it with `.get()` and fall through to `error()` when it's missing.

Gold bugs found (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.

Gold bugs missed (0)

None.