feat(authz): ADR-0066 D4 — action dual-surface gates (server source of truth)#2238
Merged
Conversation
… truth) - spec: ActionSchema gains `requiredPermissions: string[]` (mirrors App/Object). - runtime: http-dispatcher.handleActions enforces it BEFORE executing — resolves the action def from the object schema and rejects (403) when the caller's systemPermissions don't cover requiredPermissions. isSystem bypasses; an unauthenticated caller (no caps) is denied. One declaration gates both surfaces (objectui ActionRunner derives the UI hide/disable from the same field — separate PR), removing the "UI-gated but server-open" footgun. - liveness ledger: classify action.requiredPermissions (live). api-surface unchanged. - Tests: spec (+2) + full-dispatcher gate (+5: deny/allow/system-bypass/ungated/anon). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
📓 Docs Drift CheckThis PR changes 2 package(s): 98 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements ADR-0066 D4: an action declaring
requiredPermissionsis enforced from one declaration on both surfaces — the server (action route) rejects the call when the caller lacks the capability (the source of truth), and the objectui ActionRunner hides/disables it from the same field (UI gating PR follows). Removes the "UI-gated but server-open" footgun (and the inverse).Changes
ui/action.zod.ts):ActionSchema.requiredPermissions: string[](optional; mirrorsApp.requiredPermissions/ ObjectrequiredPermissions).http-dispatcher.tshandleActions): before executing, resolve the action def from the object schema and enforceaction.requiredPermissions ⊆ ctx.systemPermissions→ 403 otherwise.isSystem(engine self-invocation) bypasses; an unauthenticated caller holds no capabilities and is denied for a gated action. Schema unresolved ⇒ no declared gate (handler-only action) — fail-safe to the data layer.action.requiredPermissionsclassifiedlive. api-surface unchanged (field add, no new export).Tests
action.test.ts(+2): acceptsrequiredPermissions; optional.http-dispatcher.test.ts(+5): deny (403) / allow / system-bypass / un-gated / anonymous-deny. Full 126-test dispatcher suite green; full-DTS build green.Follow-up: objectui
ActionRunnerderives the UI hide/disable fromrequiredPermissions(separate objectui PR).🤖 Generated with Claude Code