Skip to content

fix(auth): hold scoped keys and lower roles to what they were granted - #2562

Merged
Makisuo merged 3 commits into
mainfrom
sec/scoped-key-role-gates
Nov 13, 2026
Merged

Makisuo merged 3 commits into
mainfrom
sec/scoped-key-role-gates

Merge remote-tracking branch 'origin/main' into sec/scoped-key-role-g…

c892660
Select commit
Loading
Failed to load commit list.
Maple Review Bot / Maple / review succeeded Nov 13, 2026 in 2m 54s

Confidence 10/10 · No issues found

🟢 Confidence 10/10 · safe to merge. Scope and role plumbing is the risk here; each of the five gates is pinned by a test that fails without it.
no findings · tests covered · risk high

Five authorization narrowings: scoped keys must hold a write scope to read monitor secrets or AWS setup, device keys can no longer be minted or used via MCP, Security Center telemetry needs security:manage, and demotion expires pending CLI/MCP approvals made above the new role.

  • canWriteMonitors now also requires the key's uptime_monitors:write scope
  • AWS setup requires integrations:write for scoped keys
  • V2ApiKeyCreateParams.kind accepts only standard and mcp
  • securityTenant gates the exposure and runtime tabs on security:manage
What was checked
  • scopeAllows returns true for null/undefined scopes, so sessions and legacy keys keep access (v2/auth.ts:174)
  • Route family is integrations (group prefix /v2/integrations/aws), matching the handler's integrations:write check
  • highestRole([]) reads as member, so an approval with no roles survives demotion (policy/roles.ts:72)

c892660 · Reply "won't fix" to dismiss a finding, or mention @maple-review-bot to ask about one.