fix(msteams): reject malformed OAuth token envelopes [AI-assisted]#111638
fix(msteams): reject malformed OAuth token envelopes [AI-assisted]#111638Alix-007 wants to merge 1 commit into
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 20, 2026, 1:23 AM ET / 05:23 UTC. Summary PR surface: Source +14, Tests +33. Total +47 across 2 files. Reproducibility: no. current-main reproduction was independently established in this read-only review. The linked secretless proof gives a clear source-backed reproduction on the PR parent: an HTTP 200 token response containing null reached raw property access in both exchange and refresh paths. Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Rebase the focused plugin-local guard onto current Do we have a high-confidence way to reproduce the issue? No current-main reproduction was independently established in this read-only review. The linked secretless proof gives a clear source-backed reproduction on the PR parent: an HTTP 200 token response containing null reached raw property access in both exchange and refresh paths. Is this the best way to solve the issue? Yes. Validating the decoded envelope at the shared Microsoft Teams token-fetch boundary is the narrowest maintainable fix because both production flows use that path and existing token-field validation remains authoritative. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against e45ebac97abb. Label changesLabel justifications:
Evidence reviewedPR surface: Source +14, Tests +33. Total +47 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
Review history (3 earlier review cycles) |
984662c to
1d61563
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
What Problem This Solves
Fixes an issue where Microsoft Teams delegated OAuth exchange or refresh could throw a raw
TypeErrorwhen Azure returned HTTP 200 with JSONnullinstead of a token object. Other non-object envelopes are also rejected explicitly at the provider boundary.Why This Change Was Made
The decoded token response is now treated as
unknownand checked for a non-null, non-array object before any token fields are read. Existing expiry validation, exchange refresh-token requirements, refresh-token rotation fallback, timeout handling, SSRF protection, and response release remain unchanged.User Impact
Malformed Teams OAuth token envelopes fail with the existing actionable
MSTeams ... failed: invalid token response fieldserror. Valid authorization-code exchange and refresh flows behave exactly as before.Evidence
25d6f13a1ff864e241d28f4540494ecba43a6421. Exact current head:1d61563a92b1f54de9a2c479c5be6c5b2ba7dd09. The branch is not being continuously rebased.nulland array top-level responses through bothexchangeMSTeamsCodeForTokensandrefreshMSTeamsDelegatedTokens.oxfmt --checkandgit diff --checkpass.access_tokenandexpires_in: OAuth 2.0 authorization code flow.Production-entry before/after proof
The public, secretless GitHub-hosted proof run checked the immutable parent and head above. Its temporary harness called the exported exchange and refresh production entry points through the real shared guarded-fetch path. A loopback HTTP server returned HTTP 200 with
nulland[]; the URL-only fetch wrapper forwarded the exactRequestInitandAbortSignal, and the server verified the POST method and form fields.Before the fix, both
nullpaths reached raw property access:After the fix, both production entry points return the stable validation error. The array cases also pass as controls:
The proof workflow is pinned in fork commit
04dc95b79742216ad887d63a674a55bbc520decb. It uses no credentials and does not alter this PR's product diff.autoreviewwas attempted before commit; the review engine returned HTTP 401 from the Responses WebSocket, so no structured findings were produced. A separate adversarial Codex review of the exact head found no concrete code findings and judged the shared fetch boundary to be the best fix.AI-assisted (Codex): I reviewed and understand this change. Allow edits from maintainers is enabled.