Skip to content

feat(oauth): add allowInsecureIssuer flag for cluster-DNS fixtures - #94

Open
dwmkerr wants to merge 1 commit into
mainfrom
feat/allow-insecure-issuer
Open

feat(oauth): add allowInsecureIssuer flag for cluster-DNS fixtures#94
dwmkerr wants to merge 1 commit into
mainfrom
feat/allow-insecure-issuer

Conversation

@dwmkerr

@dwmkerr dwmkerr commented Apr 22, 2026

Copy link
Copy Markdown
Owner

Summary

  • metadata.allowInsecureIssuer: true bypasses mcpAuthRouter (which rejects non-HTTPS, non-loopback issuers) and mounts the SDK's exported handlers directly with metadata mock-llm builds. Unlocks mock-llm as an OAuth fixture reachable via Kubernetes cluster DNS (e.g. http://mock-llm.<ns>.svc.cluster.local:6556).
  • Default behaviour (strict HTTPS-only) unchanged. Flag is test-fixture-only and documented as such.
  • Parity test asserts emitted /.well-known/oauth-authorization-server and /.well-known/oauth-protected-resource are byte-equivalent to the SDK's output when both paths use a loopback issuer.

Test plan

  • npx tsc --noEmit clean
  • npx jest — 148/148 pass
  • New tests in src/oauth/index.spec.ts: boots with cluster-DNS issuer, HTTPS issuer still works, default still rejects HTTP non-loopback, SDK-parity golden

The MCP SDK's mcpAuthRouter rejects non-HTTPS, non-loopback issuer URLs at
boot. When mock-llm runs as a Kubernetes fixture the issuer must be the
cluster DNS name (e.g. http://mock-llm.<ns>.svc.cluster.local:6556), which
is neither, so the process crashloops.

Opt-in `metadata.allowInsecureIssuer: true` bypasses the SDK's router and
mounts the SDK's exported handlers (authorize, token, register, metadata)
directly with metadata mock-llm builds itself. Output is structurally
equivalent to the SDK's — covered by a parity test. Default behaviour
(strict HTTPS) is unchanged.
@codecov

codecov Bot commented Apr 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.67%. Comparing base (82901f8) to head (f19012a).

Files with missing lines Patch % Lines
src/oauth/index.ts 90.00% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #94      +/-   ##
==========================================
- Coverage   92.77%   92.67%   -0.10%     
==========================================
  Files          20       20              
  Lines         609      628      +19     
  Branches      110      114       +4     
==========================================
+ Hits          565      582      +17     
  Misses         30       30              
- Partials       14       16       +2     
Flag Coverage Δ
samples 92.67% <90.00%> (-0.10%) ⬇️
unittests 92.67% <90.00%> (-0.10%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant