← Back to Pull requests

feat(mcp-oauth): a retry of a lost refresh answer is not a reuse (W48, D1705) #334

Open
unknown opened this pull request with 234 lines diff across 2 files
View on GitHub
unknown unknown commented on Oct 28, 2026 20:03 UTC
Author

Round 6, W48, PR 7c of docs/plans/security.md. Stacked on #327 (base feat/w48-security, which writes D1705).

Decision

  • D1705 — a spent MCP refresh token presented again by its own client within 60 seconds of its spend, while the refresh token that spend issued is unused, is a retry of a lost answer: the node revokes the access token the lost answer carried, forgets its refresh token and refreshes again (D1519's checks again). After the window, once the successor was used, or from another client id, it is a reuse and ends the sign-in, as before. spentAt is added to the record (additive; records without it have no window). The client id, resource and scope are checked before the retry decision, so a mismatched retry is never taken for one. Deferred item "a refresh whose answer is lost" is narrowed accordingly.
  • Evidence

    $ ~/.t3/jhin-heavy vp test run plugins/mcp-oauth/test
          Tests  32 passed (32)
    
    $ vp check docs/plans/security.md plugins/mcp-oauth/src plugins/mcp-oauth/test
    pass: All 8 files are correctly formatted
    pass: Found no warnings or lint errors in 7 files
    
    $ vp run --filter @jhin/plugin-mcp-oauth typecheck
    ~/plugins/mcp-oauth$ tsc --noEmit
    

    New tests in oauth.test.ts:

  • "answers a retry of a lost refresh answer within a minute, and drops what that answer carried (security.md D1705)": the lost pair's access token is refused, its refresh token is invalid_grant without ending the sign-in, the retry's pair works and rotates; 61 s after a spend the same token is a reuse and ends the sign-in.

  • "ends the sign-in when another client retries a spent refresh token (security.md D1705)".

  • Unchanged and passing: "revokes the sign-in's current tokens when a spent refresh token comes back" (successor already used) and the two concurrency cases.
  • 🤖 Generated with Claude Code

    Diff: 234 lines (+175 / -59) across 2 files Reviewer: claude[bot] Review duration: 6m
    All Vouch review confidence checks passed
    Residual risk 0.32 = Change Risk (0.60) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.60 · 234 lines diff across 2 files
    0.60
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.327
    Sensitive Paths sensitive_paths
    0.060
    Real PR Conversation Timeline
    1 comments
    "Review active on #334"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed sensitive_module
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 60.3% (MEDIUM) · Higher = larger blast radius
    60.3%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 32.1% · Safe to merge
    32.1%
    Repository