Harden MCP portal authentication changes - #199
Conversation
| connected: ServerAuthKind, configured: ServerAuthKind, | ||
| ): boolean { | ||
| return (connected === "token") !== (configured === "token"); | ||
| return configured === "oauth" ? connected === "token" : connected !== configured; |
There was a problem hiding this comment.
The doc-comment above (lines 165-168) is now stale relative to this new logic. It says probing may legitimately move between none and OAuth (bidirectionally), but configured === "oauth" ? connected === "token" : connected !== configured only tolerates that drift when the portal is configured as oauth. When configured as none, a connected oauth state now requires a reconnect (connected !== configured) — the intended new hardening, but it contradicts the comment. Please update the doc to describe the asymmetric rule (an oauth-configured portal may prove public during probing, while an explicitly none-configured portal stays strict).
|
Review submitted with one inline finding. I reviewed the PR (hardening MCP portal authentication). The logic is sound: the auth-mode reconnect rule, the OAuth fallback/callback gates, the connection-generation invalidation, and the per-revision in-flight counter all correctly implement "clear stale OAuth state / refuse paths no longer allowed / invalidate on token-authority change." The truth-table change to I submitted 1 inline finding: the doc-comment on |
972434f to
b4a5027
Compare
2846cdc to
f5c6473
Compare
|
I've completed my review. My analysis confirms the logic is sound across all six files:
The only actionable issue is the stale doc-comment on No new actionable findings. (1 pre-existing finding — the stale |
|
Now let me examine the Consider a portal reconfigured from
Now consider
The logic is coherent. Now let me double check one concern in I've completed a thorough review. The implementation is sound. The only actionable finding is the stale doc-comment on No new actionable findings. (1 pre-existing finding — the stale |
Portal authentication mode and deployment-owned tokens can change while an account or facet remains live. This makes auth-mode transitions clear stale OAuth state, refuses fallback/callback paths no longer allowed by current configuration, and invalidates captured connection generations when token authority changes.
OAuth redirects record their configuration revision before handing off to the callback, preventing an existing facet from invalidating the attempt while the user is authorizing.
Stacked on #170. Verified with the MCP and portal suites plus full
pnpm lint.