Repository navigation
Conversation
…tion The auth middlewares now refuse a session or credential whose highest role is observer any request that is not a read or a change to the caller's own state. It is refused by default: an endpoint passes only as a GET, when it is marked ObserverAccess, or on /v2 when the scope registry already names it a read. Marked read: the dashboard query groups and the previews that sit beside writes. Marked personal: the caller's digest, devices, MCP connection and CLI and MCP sign-in approvals, which pin the caller's role. Internal routes answer with ReadOnlyRoleError, /v2 with insufficient_permissions, and API key denials are audited.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
Maple review🟢 Confidence 8/10 · likely safe to merge. Fail-closed gate with readable markers; the internal and public middleware wiring has no end-to-end observer test, only the gate functions. Refuses a read-only role every non-GET endpoint the internal, public and
Before merge
|
Second layer of the Observer role, on top of #2543. An observer is now refused every HTTP endpoint that changes the organization.
What changed
/v2) refuse a session or credential whose highest role is observer unless the request only reads or changes the caller's own state.ObserverAccess, or on/v2when the scope registry already names it a read. A new endpoint is refused until someone marks it.read: the dashboard query groups (query engine, users, AI sessions, MCP servers, AI models, session replays) and the previews that sit beside writes (digest previews, escalation policy dry run, billing price preview, two integration reads).personal: the caller's digest subscription, mobile and widget devices, device credentials, their own MCP connection, agent feedback, and the CLI and MCP sign-in approvals. Those approvals pin the caller's role, so the credential they mint is read-only too.403 read_only_role,/v2answers403 insufficient_permissions, both with "Observers can read Maple but not change it. Ask an org admin for the Member role to make changes." API key denials are audited like the other denials./v2endpoints now listinsufficient_permissionsas a possible 403, so the iOS OpenAPI document is regenerated.Of the 412 non-GET endpoints across the APIs, 186 stay open to observers, 17 more through the
/v2read registry, and 209 are refused.Verified
packages/domain:observer-access.test.ts, policy, anticipated errors, OpenAPI and v2 contract tests, 94 passed.packages/backend:observer-gate.test.ts, 5 passed.apps/api: the whole package, 689 passed. New cases run the real/v2middleware with an observer-pinned key: it reads an issue and is refused a transition (403, nothing recorded), searches traces by POST, and registers and removes its own device.@maple/domain,@maple/backend,@maple/apiand@maple/web; the CI lint config on every changed file.Known gaps, handled in later layers or follow-ups
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.