Skip to content

Remove hardcoded permission allowlist for expert MCP tokens - #8185

Open
cstns wants to merge 4 commits into
mainfrom
feat/8066_remove-expert-mcp-allowlist
Open

Remove hardcoded permission allowlist for expert MCP tokens#8185
cstns wants to merge 4 commits into
mainfrom
feat/8066_remove-expert-mcp-allowlist

Conversation

@cstns

@cstns cstns commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Remove the user:expert-mcp entry from IMPLICIT_TOKEN_SCOPES in forge/routes/auth/permissions.js
  • Clear session.scope for user:expert-mcp tokens in the auth flow so they inherit the user's full permissions (gated by team role)
  • The token is short-lived (5 min TTL) and first-party only. HITL approval cards and scoped PATs provide the access control now.

This was a safety measure from before HITL and scoped PATs existed. Every new tool capability required updating the hardcoded list or it would silently fail.

Changes

  • forge/routes/auth/permissions.js: removed 30-line allowlist
  • forge/routes/auth/index.js: delete session.scope for user:expert-mcp tokens after validation
  • test/unit/forge/routes/auth/permissions_spec.js: updated test fixtures and expectations to reflect role-based permissions instead of allowlist

Related Issue(s)

Closes #8066

Test plan

  • Expert MCP token with Member role can access member-level permissions (team:read, project:read, etc.)
  • Expert MCP token with Owner role can access owner-level permissions (team:edit)
  • Expert MCP token with Member role cannot access owner-level permissions (team:edit)
  • Plain user token with ff-expert:platform scope does NOT gain broad access
  • Existing project/device implicit scopes are unaffected

The user:expert-mcp entry in IMPLICIT_TOKEN_SCOPES was a safety measure
from before HITL and scoped PATs existed. With both now in place, the
allowlist is a duplicate gate that adds maintenance overhead without
meaningful protection. Every new tool capability required updating this
list or it would silently fail.

The expert MCP token now inherits the user's full permissions (gated by
team role). The token is short-lived (5 min TTL) and first-party only.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@cstns cstns self-assigned this Aug 11, 2026
@cstns
cstns requested review from Steve-Mcl and n-lark and removed request for n-lark August 11, 2026 16:23
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented Aug 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.19%. Comparing base (9a1d367) to head (fd76f23).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #8185   +/-   ##
=======================================
  Coverage   76.19%   76.19%           
=======================================
  Files         441      441           
  Lines       23619    23621    +2     
  Branches     6289     6290    +1     
=======================================
+ Hits        17996    17998    +2     
  Misses       5623     5623           
Flag Coverage Δ
backend 76.19% <100.00%> (+<0.01%) ⬆️

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

☔ View full report in Codecov by Harness.
📢 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.

@cstns
cstns deployed to staging August 12, 2026 12:45 — with GitHub Actions Active
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.

Remove hardcoded permission allowlist for the first party expert MCP tokens

1 participant