Skip to content

fix(core): allow reducing OAuth consent scopes - #2188

Merged
ascorbic merged 1 commit into
emdash-cms:mainfrom
saariuslystoned:codex/mcp-oauth-consent-scopes-2093
Jul 22, 2026
Merged

ascorbic merged 1 commit into
emdash-cms:mainfrom
saariuslystoned:codex/mcp-oauth-consent-scopes-2093

Conversation

@saariuslystoned

Copy link
Copy Markdown
Contributor

What does this PR do?

Makes authorization-code consent scopes individually selectable so users can remove permissions an MCP client does not need before approving access. Requested scopes remain selected by default for compatibility, while submitted selections are constrained to the original request and continue through existing client- and role-based clamps.

Empty effective grants now return invalid_scope, duplicate requested scopes render once, plugin-specific MCP scopes remain selectable, and the consent copy reflects content:write compatibility grants.

Closes #2093

Type of change

  • Bug fix
  • Feature (requires maintainer-approved Discussion)
  • Refactor (no behavior change)
  • Translation
  • Documentation
  • Performance improvement
  • Tests
  • Chore (dependencies, CI, tooling)

Checklist

  • I have read CONTRIBUTING.md
  • pnpm typecheck passes
  • pnpm lint passes
  • pnpm test passes (or targeted tests for my change)
  • pnpm format has been run
  • I have added/updated tests for my changes (if applicable)
  • User-visible strings in the admin UI are wrapped for translation (if applicable). Do not include messages.po changes except in translation PRs — a workflow extracts catalogs on merge to main. (N/A: this extends the existing standalone server-rendered OAuth consent surface, not the Lingui admin SPA.)
  • I have added a changeset (if this PR changes a published package)
  • New features link to an approved Discussion: N/A — bug fix for MCP server can be overscoped for Admins #2093

AI-generated code disclosure

  • This PR includes AI-generated code — model/tool: Cursor + GPT-5.6 Sol

Screenshots / test output

Exact source identity:

  • Base: 7d28ce940a7bc05043bd01c79cae07c7a1d00898
  • Head: 6179d69f1e3536bd922eaed7db75ab30d41612be

Verification:

  • Focused OAuth/MCP regression suite: 4 files, 87 tests passed
  • pnpm typecheck: passed
  • pnpm lint: passed with warnings denied
  • pnpm format:check: passed
  • Source-blind demos/simple Node/SQLite behavior: passed
  • Source-blind demos/cloudflare local workerd/D1 behavior: passed
  • Reduced grants, unrequested-scope injection, restricted clients, empty grants, and refresh non-broadening passed in both runtimes
  • Full package suite reached 4,984 passing core tests and 3 skipped; one unrelated macOS /var vs /private/var path assertion failed in virtual-modules.test.ts
  • Exact-head Spark-2 OpenClaw review: completed clean, no accepted/actionable findings, confidence 0.95

Internal proof root: /Users/cp-1/Developer/_machine-runs/emdash-upstream-2093-scoped-grants-20260721/

Made with Cursor

@changeset-bot

changeset-bot Bot commented Jul 22, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 76f4d26

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

This PR includes changesets to release 17 packages
Name Type
emdash Patch
@emdash-cms/cloudflare Patch
@emdash-cms/sandbox-workerd Patch
@emdash-cms/plugin-mcp-smoke Patch
@emdash-cms/fixture-perf-site Patch
@emdash-cms/perf-demo-site Patch
@emdash-cms/cache-demo-site Patch
@emdash-cms/do-demo-site Patch
@emdash-cms/do-solo-demo-site Patch
@emdash-cms/admin Patch
@emdash-cms/auth Patch
@emdash-cms/blocks Patch
@emdash-cms/gutenberg-to-portable-text Patch
@emdash-cms/x402 Patch
create-emdash Patch
@emdash-cms/auth-atproto Patch
@emdash-cms/plugin-embeds 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

@github-actions

github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@saariuslystoned

saariuslystoned commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

OpenClaw exact-head review closeout

Result: completed / clean
Summary: no accepted or actionable findings reported; overall patch correct with confidence 0.95.
Review cycle: 1; terminal head still matches the current PR.

Target: emdash-cms/emdash PR 2188
Base ref: main
Base SHA: 7d28ce9
Submitted and current head: 6179d69
Operator mode: blocking Spark-2 review
Command: bin/smoky lane run spark-openclaw-autoreview --remote-worktree /home/smoky/Developer/_machine-runs/spark-openclaw-review-worktrees/emdash-mcp-oauth-consent-scopes-2093-codex-mcp-oauth-consent-scopes-2093-6179d69f --mode branch --base 7d28ce9 --engine codex
Terminal result: completed
Terminal proof: runs/spark-openclaw-autoreview-runs/spark-openclaw-autoreview-20260722T012618Z-21291/PROOF.md

Source-blind behavior: Node/SQLite and local workerd/D1 satisfy the selectable-scope contract. Reduced grants, unrequested-scope injection, restricted clients, empty grants, and refresh non-broadening passed in both runtimes.

OpenClaw result: completed / clean
OpenClaw summary: no accepted/actionable findings reported

Gates honored: read-only review; no merge, deploy, release, customer sends, secrets, account changes, or destructive cleanup.

@pkg-pr-new

pkg-pr-new Bot commented Jul 22, 2026

Copy link
Copy Markdown

Open in StackBlitz

@emdash-cms/admin

npm i https://pkg.pr.new/@emdash-cms/admin@2188

@emdash-cms/auth

npm i https://pkg.pr.new/@emdash-cms/auth@2188

@emdash-cms/auth-atproto

npm i https://pkg.pr.new/@emdash-cms/auth-atproto@2188

@emdash-cms/blocks

npm i https://pkg.pr.new/@emdash-cms/blocks@2188

@emdash-cms/cloudflare

npm i https://pkg.pr.new/@emdash-cms/cloudflare@2188

@emdash-cms/contentful-to-portable-text

npm i https://pkg.pr.new/@emdash-cms/contentful-to-portable-text@2188

emdash

npm i https://pkg.pr.new/emdash@2188

create-emdash

npm i https://pkg.pr.new/create-emdash@2188

@emdash-cms/gutenberg-to-portable-text

npm i https://pkg.pr.new/@emdash-cms/gutenberg-to-portable-text@2188

@emdash-cms/plugin-cli

npm i https://pkg.pr.new/@emdash-cms/plugin-cli@2188

@emdash-cms/plugin-types

npm i https://pkg.pr.new/@emdash-cms/plugin-types@2188

@emdash-cms/registry-client

npm i https://pkg.pr.new/@emdash-cms/registry-client@2188

@emdash-cms/registry-lexicons

npm i https://pkg.pr.new/@emdash-cms/registry-lexicons@2188

@emdash-cms/registry-verification

npm i https://pkg.pr.new/@emdash-cms/registry-verification@2188

@emdash-cms/sandbox-workerd

npm i https://pkg.pr.new/@emdash-cms/sandbox-workerd@2188

@emdash-cms/x402

npm i https://pkg.pr.new/@emdash-cms/x402@2188

@emdash-cms/plugin-ai-moderation

npm i https://pkg.pr.new/@emdash-cms/plugin-ai-moderation@2188

@emdash-cms/plugin-atproto

npm i https://pkg.pr.new/@emdash-cms/plugin-atproto@2188

@emdash-cms/plugin-audit-log

npm i https://pkg.pr.new/@emdash-cms/plugin-audit-log@2188

@emdash-cms/plugin-color

npm i https://pkg.pr.new/@emdash-cms/plugin-color@2188

@emdash-cms/plugin-embeds

npm i https://pkg.pr.new/@emdash-cms/plugin-embeds@2188

@emdash-cms/plugin-field-kit

npm i https://pkg.pr.new/@emdash-cms/plugin-field-kit@2188

@emdash-cms/plugin-forms

npm i https://pkg.pr.new/@emdash-cms/plugin-forms@2188

@emdash-cms/plugin-webhook-notifier

npm i https://pkg.pr.new/@emdash-cms/plugin-webhook-notifier@2188

commit: 76f4d26

Co-authored-by: Cursor <cursoragent@cursor.com>
@saariuslystoned
saariuslystoned force-pushed the codex/mcp-oauth-consent-scopes-2093 branch from 6179d69 to 76f4d26 Compare July 22, 2026 01:33
@saariuslystoned

saariuslystoned commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

OpenClaw exact-head review closeout — supersedes the prior SHA

Result: completed / clean
Summary: no accepted or actionable findings reported; overall patch correct with confidence 0.90.
Review cycle: 2; terminal head matches the current PR.

The prior head was rewritten only to bind the commit author/committer to Bobby's existing CLA-linked GitHub identity. Patch content is unchanged.

Target: emdash-cms/emdash PR 2188
Base ref: main
Base SHA: 7d28ce9
Submitted and current head: 76f4d26
Operator mode: blocking Spark-2 review
Command: bin/smoky lane run spark-openclaw-autoreview --remote-worktree /home/smoky/Developer/_machine-runs/spark-openclaw-review-worktrees/emdash-mcp-oauth-consent-scopes-2093-codex-mcp-oauth-consent-scopes-2093-76f4d26c --mode branch --base 7d28ce9 --engine codex
Terminal result: completed
Terminal proof: runs/spark-openclaw-autoreview-runs/spark-openclaw-autoreview-20260722T013314Z-29327/PROOF.md

OpenClaw result: completed / clean
OpenClaw summary: no accepted/actionable findings reported

Gates honored: read-only review; no merge, deploy, release, customer sends, secrets, account changes, or destructive cleanup.

@ascorbic ascorbic left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good addition. As a security-related PR I did comprehensive adversarial reviews with Opus and Sol, as well as manual testing, and all looks good. Thanks!

Image

@ascorbic

Copy link
Copy Markdown
Collaborator

@saariuslystoned can you not include the OpenClaw comments. They are noisy and distracting.

@ascorbic
ascorbic merged commit 0eb389f into emdash-cms:main Jul 22, 2026
46 checks passed
@emdashbot emdashbot Bot mentioned this pull request Jul 22, 2026
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.

MCP server can be overscoped for Admins

2 participants