← Back to Pull requests

Allow opting in to plain-HTTP OAuth requests per component #56

Closed
unknown closed this pull request without merging on Nov 16, 2026 16:03 UTC
View on GitHub
unknown unknown commented on Nov 14, 2026 13:54 UTC
Author

Context

oauth4webapi refuses http: endpoints. This blocks local development against a Community Solid Server on http://localhost, for example the Solid test suite's end-to-end tests.

This PR builds on #18 which started from loopback detection and then moved to a global InsecureConfiguration.allow() switch after this review. This PR keeps the opt-in idea, the deprecation-on-purpose approach and the default-secure stance from #18. It replaces the global switch with options that each component takes in its constructor, and it covers discovery, registration and refresh, which #18 missed.

Per-component allowInsecureRequests also follows @jeswr's work.

Related: #21 (custom fetch).

Change

Each component that calls oauth4webapi takes an optional oauth.HttpRequestOptions as its last constructor argument.

allowInsecureRequests() creates the options for the application author, who then needs no knowledge of oauth4webapi's symbol:

const asProvider = new DiscoveryAuthorizationServerProvider(issuerProvider, allowInsecureRequests())
const clientProvider = new DynamicRegistrationClientProvider(allowInsecureRequests())
const tokenProvider = new DPoPTokenProvider(callbackUri, ui, asProvider, clientProvider, allowInsecureRequests())

Components changed:

  • DiscoveryAuthorizationServerProvider: discovery.

  • DynamicRegistrationClientProvider: registration.

  • ClientCredentialsTokenProvider: discovery and client-credentials grant.

  • DPoPTokenProvider: authorization-code grant and refresh grant.

  • BearerTokenProvider: discovery, registration and authorization-code grant.
  • Behaviour change

    BearerTokenProvider is no longer insecure by default. It had a hard-coded constant that allowed plain HTTP for every consumer. Anyone who relied on this against a local server must now pass allowInsecureRequests().

    Diff: 257 lines (+192 / -65) across 3 files Reviewer: jeswr Review duration: 3008m
    All Vouch review confidence checks passed
    Residual risk 0.26 = Change Risk (0.62) × (1 − Review Confidence (0.58)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.62 · 257 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%
    57%
    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.332
    Shallow Review Depth shallow_review_depth
    0.289
    Sensitive Paths sensitive_paths
    0.062
    Real PR Conversation Timeline
    1 comments
    "Review active on #56"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 58.0% 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.3% (MEDIUM) · Higher = larger blast radius
    62.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: 58.0% · Lower = rushed or shallow review
    58.0%
    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: 26.2% · Safe to merge
    26.2%