Skip to content

fix(backend): validate token exchange resource components and sparse scopes - #10893

Draft
wyattjoh wants to merge 1 commit into
mainfrom
wyattjoh/repair-backend-d6-d2
Draft

wyattjoh wants to merge 1 commit into
mainfrom
wyattjoh/repair-backend-d6-d2

Conversation

@wyattjoh

Copy link
Copy Markdown
Contributor

Description

What: Reject malformed resource URI components and sparse or non-string scope entries in oauthApplications.__experimental_exchangeToken() before making a request.

Why: The client currently accepts raw brackets in resource paths and can serialize sparse scope arrays into invalid values such as read , forwarding requests that do not meet the token-exchange parameter grammar.

How:

  • Validate raw URI components before URL parsing while preserving valid resource strings, IPv6 hosts, query parameters, and the existing HTTPS/loopback policy. This enforces the absolute-URI requirement in RFC 8693 §2.1 and the component grammar in RFC 3986 §3.2 and §3.3.
  • Visit every scope position and reject missing or non-string entries rather than skipping holes or coercing values into tokens, preserving the scope grammar in RFC 6749 §3.3 and the existing invalid_request error contract.

Checklist

  • pnpm test runs as expected (backend Node and edge suites).
  • pnpm build runs as expected (backend and its dependencies).
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

@vercel

vercel Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
clerk-js-sandbox Ready Ready Preview Nov 19, 2026 2:08am UTC
mosaic-docs Ready Ready Preview Nov 19, 2026 2:08am UTC
swingset Ready Ready Preview Nov 19, 2026 2:08am UTC

Request Review

@changeset-bot

changeset-bot Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: ee29bd5

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 11 packages
Name Type
@clerk/backend Patch
@clerk/astro Patch
@clerk/express Patch
@clerk/fastify Patch
@clerk/hono Patch
@clerk/nextjs Patch
@clerk/nuxt Patch
@clerk/react-router Patch
@clerk/tanstack-react-start Patch
@clerk/testing Patch
@clerk/swingset Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@pkg-pr-new

pkg-pr-new Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@10893

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@10893

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@10893

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@10893

@clerk/electron

npm i https://pkg.pr.new/@clerk/electron@10893

@clerk/electron-passkeys

npm i https://pkg.pr.new/@clerk/electron-passkeys@10893

@clerk/eslint-plugin

npm i https://pkg.pr.new/@clerk/eslint-plugin@10893

@clerk/expo

npm i https://pkg.pr.new/@clerk/expo@10893

@clerk/expo-biometrics

npm i https://pkg.pr.new/@clerk/expo-biometrics@10893

@clerk/expo-google-signin

npm i https://pkg.pr.new/@clerk/expo-google-signin@10893

@clerk/expo-native-components

npm i https://pkg.pr.new/@clerk/expo-native-components@10893

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@10893

@clerk/express

npm i https://pkg.pr.new/@clerk/express@10893

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@10893

@clerk/hono

npm i https://pkg.pr.new/@clerk/hono@10893

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@10893

@clerk/mosaic

npm i https://pkg.pr.new/@clerk/mosaic@10893

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@10893

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@10893

@clerk/react

npm i https://pkg.pr.new/@clerk/react@10893

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@10893

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@10893

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@10893

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@10893

@clerk/ui

npm i https://pkg.pr.new/@clerk/ui@10893

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@10893

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@10893

commit: ee29bd5

This branch was successfully deployed

2 active deployments
Preview – swingset — ee29bd55 Deployed Nov 19, 2026 by vercel[bot]
Preview – clerk-js-sandbox — ee29bd55 Deployed Nov 19, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant