← Back to Pull requests

Match token providers on WWW-Authenticate challenges #55

Closed
unknown closed this pull request without merging on Nov 16, 2026 15:44 UTC
View on GitHub
unknown unknown commented on Nov 12, 2026 15:51 UTC
Author

Providers now decide whether to react to a 401 from its WWW-Authenticate challenges instead of matching every response (DPoP, client credentials) or a hard-coded host (Bearer). This lets several providers coexist, each reacting only to challenges it can answer.

Changes

  • parseChallenges: RFC 9110 §11.6.1 challenge parser adapted from oauth4webapi v3.8.7 (parseWwwAuthenticateChallenges is internal there). Other npm parsers (auth-header, www-authenticate, http-auth-utils) fail on multi-challenge headers. MIT notice in the file header.

  • TokenProvider.matches(request, challenges): both managers parse the challenges once per 401 and pass them to each provider.

  • Matching rules:
  • | Provider | Matches a challenge with scheme |
    |---|---|
    | DPoPTokenProvider | DPoP or Bearer |
    | ClientCredentialsTokenProvider | DPoP or Bearer |
    | BearerTokenProvider | Bearer (still excludes .solidweb.org, now TODO) |

    Why Bearer counts for DPoP

    Observed unauthenticated 401 challenges:

    | Server | WWW-Authenticate |
    |---|---|
    | CSS 7, NSS (solidcommunity.net, teamid.live) | Bearer scope="openid webid" |
    | solidweb.org, datapod.igrant.io | Bearer realm="…", scope="openid webid" |
    | ESS (storage.inrupt.com) | UMA as_uri="https://uma.inrupt.com", ticket="…",Bearer,DPoP algs="ES256 RS256" |

    Only ESS advertises DPoP, yet all accept DPoP-bound tokens, which RFC 9449 §7.1 permits after a Bearer challenge.

    Behaviour change

    Without challenges (header missing, malformed, or not exposed by CORS Access-Control-Expose-Headers) no provider matches. Before, DPoP and client credentials matched every 401. CSS and ESS expose the header.

    Not in scope

  • Credential boundary (which origins may receive tokens).

  • algs, error (use_dpop_nonce, invalid_token), resource_metadata (LWS / RFC 9728) and UMA are not used for matching. With several matching providers, list order decides; the README documents this.

  • Servers answering 403 without a challenge (Manas, Nextcloud, PHP Solid Server) remain unreachable by any 401-reactive rule.
  • Diff: 260 lines (+195 / -65) across 3 files Reviewer: jeswr Review duration: 5753m
    All Vouch review confidence checks passed
    Residual risk 0.25 = Change Risk (0.62) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.62 · 260 lines diff across 3 files
    0.62
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    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
    Diff Size diff_size
    0.333
    Shallow Review Depth shallow_review_depth
    0.289
    Sensitive Paths sensitive_paths
    0.062
    Real PR Conversation Timeline
    1 comments
    "Review active on #55"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% 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: 62.4% (MEDIUM) · Higher = larger blast radius
    62.4%
    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: 60.5% · Lower = rushed or shallow review
    60.5%
    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: 24.6% · Safe to merge
    24.6%