GLM-5.3 · 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
- 5
- Comments matching a bug
- 0
- Comments not matching
- 5
- Cost of this PR
- $1.002
Published comments (5)
Constant OAuth state allows forged callbacks to link attacker installation — The `state` is `pipeline.signature`, an md5 constant identical for every user and session, so the callback check binds to nothing — an attacker's `code` and `installation_id` can be forged into a victim's in-progress pipeline. Generate per-session state with `secrets.token_hex()` and `pipeline.bind_state()`, then validate with `pipeline.fetch_state()`.
Unverified installation linked when Integration row does not yet exist — When the async installation webhook is delayed, the `Integration.DoesNotExist` branch never verifies the installer, yet `pipeline.next_step()` links the installation anyway — letting an attacker race the webhook and link to a victim org. Fail closed by returning the `error()` page instead.
Unguarded `integration.metadata["sender"]["login"]` raises KeyError when sender metadata is missing — Because this pipeline never binds `sender` and `ensure_integration` replaces metadata wholesale on re-link, the field can be absent and `integration.metadata["sender"]["login"]` raises KeyError, a 500 crash. Use `.get("sender", {}).get("login")` and fail closed with `error()` when it is None.
get_user_info can raise HTTPError and crash setup with a 500 — Because `get_user_info` calls `raise_for_status()`, any non-2xx from api.github.com propagates as HTTPError into a 500 mid-install rather than the graceful `error()` page. Wrap the call and return `error()` on failure, mirroring the framework's callback handling.
Unwrapped token exchange crashes pipeline with 500 on network errors — Because the `safe_urlopen` exchange is unwrapped, a ConnectionError or ReadTimeout reaching github.com crashes the pipeline with a 500 instead of rendering the installation-failed page. Catch `ConnectionError`, `SSLError`, and `Timeout` and return `error()`, as `exchange_token` does.
Gold bugs found (0)
None.