MiniMax M3 · 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
- $0.281
Published comments (5)
Unsafe metadata access raises KeyError on legacy Integrations — Reading `integration.metadata["sender"]["login"]` raises `KeyError` for legacy `Integration` rows written under the prior metadata contract, surfacing as HTTP 500. Use `integration.metadata.get("sender", {}).get("login")` and treat a missing value as a mismatch, and ensure the metadata writer stores `sender.login` going forward.
Use constant_time_compare for OAuth state CSRF token check — The `!=` comparison leaks per-character timing of `pipeline.signature`, defeating the CSRF check. Replace it with `django.utils.crypto.constant_time_compare` (already used in `auth/superuser.py` and `integrations/github/webhook.py`), passing empty strings when either side is `None`.
Helper passes bare-string error_short so xgettext never extracts it — `xgettext` only scans literals passed to recognized translation functions, so callers passing bare `error_short=` strings (and the default `"Invalid installation request."`) will never be extracted. Define module-level `_("...")` constants such as `ERR_INTEGRATION_PENDING_DELETION_SHORT` and use them as the `error_short` default and at call sites.
test_installation_not_found exercises OAuth state mismatch, not 404 branch — `test_installation_not_found` now exits at the `OAuthLoginView` state-mismatch check, so the `Integration.DoesNotExist` branch in `GitHubInstallation` never runs and the assertion stays green if it is removed. Drive the callback with the pipeline's real signature (stub the GitHub token exchange and pull `state` from the init step's redirect) so the test reaches `GitHubInstallation`.
OAuthLoginView: token-exchange network errors escape the try/except — `safe_urlopen` on the token-exchange call sits outside the surrounding `try/except Exception`, so `ReadTimeout`, `ConnectionError`, etc. from `SafeSession.request` bubble up as an HTTP 500 instead of the designed dialog. Move the call (along with `safe_urlread` and `parse_qsl`) inside the `try` block. **Also found in:** - `src/sentry/integrations/github/integration.py:434-436`
Gold bugs found (1)
Gold bugs missed (0)
None.