Skip to content

Validate OAuth discovery metadata identity (RFC 8414 / RFC 9728 / RFC 8707)#1457

Open
RhysSullivan wants to merge 3 commits into
mainfrom
fix/dcr-discovery-validation
Open

Validate OAuth discovery metadata identity (RFC 8414 / RFC 9728 / RFC 8707)#1457
RhysSullivan wants to merge 3 commits into
mainfrom
fix/dcr-discovery-validation

Conversation

@RhysSullivan

Copy link
Copy Markdown
Collaborator

From the DCR spec audit, the three discovery-layer gaps:

  • RFC 8414 §3.3 issuer validation: authorization-server metadata whose issuer does not match the URL it was derived from is now rejected at probe time (canonical scheme/host/port/path comparison; trailing slash tolerated). Previously wrong-issuer metadata could drive the whole flow.
  • RFC 9728 §3.3 resource validation: protected-resource metadata must name exactly the requested resource identifier. The ancestor-prefix acceptance in validateResourceIndicator is gone; a PRM discovery failure now surfaces as a typed probe error instead of silently falling back to AS-only discovery.
  • RFC 8707 canonicalization: canonicalResourceUrl keeps query strings and trailing slashes (both identifier-significant) and registerDynamicClient canonicalizes the resource once before reuse-matching and persistence, so authorize/token requests carry the same canonical value the row stores.

Also adds emulator-backed e2e scenarios (e2e/scenarios/oauth-dcr-compliance.test.ts, emulate 0.13.7's new MCP oauth knobs): issuer-mismatch and foreign-resource rejection pass on this branch; two auth-method negotiation scenarios are checked in skipped (self-documenting) until the follow-up that persists the DCR response's token_endpoint_auth_method.

Four scenarios against the MCP emulator's new oauth misbehavior knobs
(emulate 0.13.7): issuer-mismatch rejection (RFC 8414), foreign-resource
rejection (RFC 9728), client_secret_basic negotiation when the metadata
omits auth methods, and honoring a server-substituted auth method
(RFC 7591). The first two pass with the discovery validation on this
branch; the last two stay red until auth-method negotiation is fixed.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 23, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
executor-marketing 4dff9e5 Commit Preview URL

Branch Preview URL
Jul 23 2026, 08:00 PM

@github-actions

github-actions Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Cloudflare preview

Console https://executor-preview-pr-1457.executor-e2e.workers.dev
MCP https://executor-preview-pr-1457.executor-e2e.workers.dev/mcp
Deployed commit 4dff9e5

Sign-in is Cloudflare Access (one-time PIN to an allowed email). The preview has its own database and encryption key; it is destroyed when this PR closes.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 23, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
executor-cloud 4dff9e5 Jul 23 2026, 08:01 PM

@pkg-pr-new

pkg-pr-new Bot commented Jul 23, 2026

Copy link
Copy Markdown

Open in StackBlitz

@executor-js/cli

npm i https://pkg.pr.new/@executor-js/cli@1457

@executor-js/config

npm i https://pkg.pr.new/@executor-js/config@1457

@executor-js/execution

npm i https://pkg.pr.new/@executor-js/execution@1457

@executor-js/sdk

npm i https://pkg.pr.new/@executor-js/sdk@1457

@executor-js/plugin-file-secrets

npm i https://pkg.pr.new/@executor-js/plugin-file-secrets@1457

@executor-js/plugin-graphql

npm i https://pkg.pr.new/@executor-js/plugin-graphql@1457

@executor-js/plugin-keychain

npm i https://pkg.pr.new/@executor-js/plugin-keychain@1457

@executor-js/plugin-mcp

npm i https://pkg.pr.new/@executor-js/plugin-mcp@1457

@executor-js/plugin-onepassword

npm i https://pkg.pr.new/@executor-js/plugin-onepassword@1457

@executor-js/plugin-openapi

npm i https://pkg.pr.new/@executor-js/plugin-openapi@1457

@executor-js/codemode-core

npm i https://pkg.pr.new/@executor-js/codemode-core@1457

@executor-js/runtime-quickjs

npm i https://pkg.pr.new/@executor-js/runtime-quickjs@1457

executor

npm i https://pkg.pr.new/executor@1457

commit: 4dff9e5

The e2e probe-failure assertions now narrow with Predicate.isTagged and
assert the typed message instead of stringifying a cast. canonicalIssuer
is hoisted to module scope with the issuer-vs-resource canonicalization
difference documented in one place, and the DCR resource
canonicalization records why legacy raw-string rows need no backfill.
@RhysSullivan
RhysSullivan marked this pull request as ready for review July 23, 2026 19:57
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