fix(auth): stop auditing routine device-flow polls as denied, mark access_denied correctly - #8400
Conversation
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
…cess_denied correctly (JSONbored#8378)
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8400 +/- ##
==========================================
- Coverage 92.12% 89.58% -2.55%
==========================================
Files 782 98 -684
Lines 78531 22751 -55780
Branches 23720 3915 -19805
==========================================
- Hits 72347 20381 -51966
+ Misses 5062 2189 -2873
+ Partials 1122 181 -941
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
Tip ✅ LoopOver review result - approve/merge recommendedReview updated: 2026-07-24 11:37:23 UTC
Review summary Nits — 3 non-blocking
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://loopover.ai/docs/loopover-commands 🧪 Experimental — new and may change. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
Summary
pollGitHubDeviceFlow(src/auth/github-oauth.ts) audited every non-success device-token response, categorising RFC 8628's routine polling states asdeniedand the one genuine user rejection as a genericerror— exactly backwards from howoutcome: "denied"is used everywhere else in the codebase.authorization_pending/slow_down— the expected response on nearly every poll of a login still in progress (~180 rows per successful login at the 5s interval over the 900s window) — now write no audit row at all. They carry no information beyond "keep polling", so they aren't audit-worthy.access_denied— the actual "user declined" signal — is now the soleoutcome: "denied", matching how the sibling web-OAuth callback inroutes.tstreats an OAutherrorparam.expired_token,bad_verification_code,incorrect_client_credentials, or anything else GitHub returns) keepsoutcome: "error", unchanged.Audit-categorisation only: the returned
{ status, message }shape, the token issued, the scopes granted, and every caller of/v1/auth/github/device/pollare all untouched.Closes #8378
Test plan
test/unit/auth.test.tsasserting all three arms: both routine states produce zeroauth.github_device_pollrows while still returning their{ status, message };access_deniedproduces exactly one row withoutcome: "denied";expired_tokenstill recordsoutcome: "error"pollGitHubDeviceFlowcoverage passes unmodified — including itsbad_verification_code→outcome: "error"assertion and itsauthorization_pending/slow_downreturn-value assertions (this change is additive to expectations, it weakens nothing)test/unit/auth.test.tsgreen (37/37); every changed line and both new branch arms are covered — the diff hunk (src/auth/github-oauth.tslines 86-97) contains none of the file's pre-existing uncovered lines/branchesnpm run typecheckclean