GLM-5.3 Flash · 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 Opus 5.5.

Gold bugs found
3 of 7
Comments published
4
Comments matching a bug
3
Comments not matching
1
Cost of this PR
$0.203

Published comments (4)

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

OAuth state uses deterministic pipeline.signature, enabling CSRF — An attacker can derive the constant `state` and forge a callback that binds their own GitHub code as `github_authenticated_user` in a victim's pipeline, defeating the user-match check. Generate a random uuid4 token per pipeline and bind it into the pipeline state instead.

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

Missing sender key in integration metadata causes unhandled KeyError — Older integrations can lack a `sender` key in `integration.metadata`, so the check raises an unhandled `KeyError` — a 500 instead of the graceful `error(...)` page other paths return. Read it with `.get()` and treat a missing sender as an invalid installation request.

mediumbugsrc/sentry/integrations/github/integration.py:129-146

gettext applied to variable in error() prevents extraction of error strings — The literals passed by callers never sit inside a `_(...)` call, so makemessages cannot extract them and users get untranslated English in every locale. Wrap each literal in `_()` at the call sites and drop the `_(error_short)` re-wrap in `error()`.

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

Unwrapped get_user_info call raises unhandled exception on GitHub API failure — Any GitHub API failure makes `get_user_info` raise as a generic 500, so the postMessage failure handshake never fires — unlike the wrapped token exchange right above. Wrap the call in try/except and return `error(request, self.active_organization)` on exception.

Gold bugs found (3)

highThe GitHub OAuth state is pipeline.signature, a static md5 of the pipeline view names, instead of a per-attempt random nonce, so it gives no CSRF protection.
mediumThe new OAuth step's token exchange and user lookup are not wrapped in error handling, so GitHub/network failures surface as 500s instead of the installation-failed page.
highThe installer check indexes integration.metadata['sender']['login'] without checking that sender exists, raising KeyError for integrations created without sender metadata.

Gold bugs missed (4)

highWhen no Integration exists yet for the installation_id the pipeline advances without comparing the OAuth user to the installer, bypassing the new ownership check.
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.
mediumGitHubInstallation re-fetches the existing Integration filtered by status=ACTIVE and errors if not found; an Integration with this external_id that is not ACTIVE and has no OrganizationIntegration now gets the generic 'Invalid installation request' page instead of advancing so ensure_integration can reactivate it, blocking re-installs.
highThe new installer-ownership check stores and compares GitHub's mutable login (OAuth /user login vs metadata sender.login) instead of the immutable numeric id; after the installer renames, another account that claims the old login passes the check and can link the installation.