Claude Opus 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
- 6
- Comments matching a bug
- 1
- Comments not matching
- 5
- Cost of this PR
- $2.608
Published comments (6)
Ownership check skipped when the installation's Integration row doesn't exist yet — An attacker who submits a victim's `installation_id` before the installation webhook creates the row skips the ownership check, and `build_integration` links the victim's installation to the attacker's org. Verify `github_authenticated_user` against the installation's sender via the app client, or fail closed when it can't be verified.
OAuth state is a predictable constant, enabling login CSRF on the GitHub callback — Since `pipeline.signature` is an md5 of view class names (see pipeline/base.py), an attacker can send a victim their own `code` with the known `state`, recording the attacker's login as `github_authenticated_user` and defeating the installer check. Generate a random state with `secrets.token_hex`, store it via `pipeline.bind_state`, and compare on callback.
KeyError when integration metadata lacks "sender" on reinstall — Since `build_integration` only writes `metadata["sender"]` when pipeline state has a sender, reinstalling such an integration after its `OrganizationIntegration` is removed raises `KeyError` and returns a 500. Read it with `integration.metadata.get("sender", {}).get("login")` and return `error()` when it's missing.
Unhandled token exchange and get_user_info failures return a 500 — A network error, or a 401/5xx from GitHub on a revoked `code`, escapes `safe_urlopen` or `get_user_info` (via `resp.raise_for_status()`) and returns a 500. Wrap both calls in try/except and return `error(request, self.active_organization)` on failure.
test_installation_not_found never reaches the 404 installation lookup — With unstubbed OAuth endpoints and a `state` that differs from the pipeline signature, `test_installation_not_found` likely fails in `OAuthLoginView` and would still pass with broken 404 handling. Drive a valid OAuth step and assert on "The GitHub installation could not be found." again.
User-mismatch test asserts only a generic error shared by other failures — State mismatch, OAuth failure and the missing ACTIVE `Integration` branch all return "Invalid installation request.", so `test_github_user_mismatch` passes even without the sender-login comparison. Assert the earlier steps succeed (`Integration` is ACTIVE with sender login 'attacker'), or give the mismatch its own message and assert on it.
Gold bugs found (1)
Gold bugs missed (0)
None.