Amazon Ergo 1.0 · Balanced
github-oauth-security-enhancement-sentry
Sentry · Python · M · 100–299 lines · 2 files
The normal review, with one generalist agent. Judge: Claude Opus 5.5.
- Gold bugs found
- 4 of 7
- Comments published
- 4
- Comments matching a bug
- 4
- Comments not matching
- 0
- Cost of this PR
- $1.077
Published comments (4)
Missing Integration row bypasses installer verification — An attacker can attach a victim’s GitHub installation to their organization without verifying the installer. Return `error(request, self.active_organization)` when `Integration.DoesNotExist` occurs instead of calling `pipeline.next_step()`.
OAuth state is predictable and shared across GitHub installations — Generate a random per-pipeline state with `secrets.token_urlsafe(32)`, store it with `pipeline.bind_state()`, and compare it with `pipeline.fetch_state()`.
safe_urlopen called outside try block, uncaught connection errors cause 500 — A connection error or timeout from GitHub’s token endpoint leaves a `requests` exception uncaught, producing a 500 instead of the installation-failed response. Move `safe_urlopen()` inside the existing `try`, as in `OAuth2CallbackView.exchange_token`.
Missing sender metadata causes KeyError instead of error page — A missing `sender` raises `KeyError`, returning a 500 instead of the intended error page. Replace `integration.metadata["sender"]["login"]` with a guarded `sender_login` lookup, returning `error()` when it is absent or does not match.