mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-03 01:28:55 +00:00
feat(mcp): plugins:use OAuth scope
One coarse scope rather than per-plugin granularity. Which plugins are
installed is runtime data, so a per-plugin scope cannot be statically
enumerated: it would break the ${group}:${mode} derivation and the
AssertExact guards in nest-mcp-policy.ts, and its consent copy could not
be written ahead of time for a third-party plugin name. Tokens issued
before a plugin existed could never carry its scope either. Per-plugin
granularity already exists one layer down as the admin's mcp:tools grant.
'use' is a fourth mode, which widens ScopeMode. Nothing else moves:
McpAccessGroup and McpAccessMode derive from Scope, so both AssertExact
guards self-heal, and the policy's fallback branch already covers a third
mode the way it covers files:content.
The presets needed an explicit exclusion. Five of the six are written as
"everything except deletes", so plugins:use would have joined Claude.ai,
Cursor, Windsurf and Zed silently and handed out third-party tool
execution without anyone choosing it. That filter was duplicated across
the desktop and mobile files with nothing pinning it, so both now use one
shared constant, and FE-OAUTH-SCOPES-012 holds the line for the next
scope like this one.
The consent copy says what the scope does not do: the RPC host authorises
from grants frozen at construction, so this scope plus weather:read still
reaches whatever the plugin itself was granted.
Two i18n gates, not one. The dot-only group key is tracked by
i18n-parity.mjs, whose regex has no colon in its character class; the
colon-bearing label/description pair is invisible to it but is compared by
client/tests/unit/i18n/parity.test.ts, which diffs merged bundles. All 23
locales get all three keys, including the three in neither gate.
The consent glyph gets a ':use' branch. Falling through to the eye would
tell the user a tool-running scope only looks at things.
This commit is contained in:
@@ -46,7 +46,7 @@ describe('ALL_SCOPES', () => {
|
||||
expect(ALL_SCOPES.length).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
it('derives exactly the 16 known scope groups (ScopeGroup lockstep)', () => {
|
||||
it('derives exactly the 17 known scope groups (ScopeGroup lockstep)', () => {
|
||||
// The runtime half of the ScopeGroup lockstep — the type half is
|
||||
// MCP_ACCESS_GROUPS_MATCH_SCOPE_GROUPS in src/mcp/nest-mcp-policy.ts,
|
||||
// covered by `npm run typecheck`. If this list changes, the MCP
|
||||
@@ -63,6 +63,7 @@ describe('ALL_SCOPES', () => {
|
||||
'notifications',
|
||||
'packing',
|
||||
'places',
|
||||
'plugins',
|
||||
'reservations',
|
||||
'settings',
|
||||
'todos',
|
||||
|
||||
Reference in New Issue
Block a user