Authorization is enforced on every entry point, not only the chat tool router #2078
Notifications
Due Date
No due date set.
Blocks
Reference: sam/archie#2078
Reference in new issue
Block a user
Why: Today the Cedar access chain is consulted in exactly one place: the chat tool router,
allowed()inmodules/chat/tools.go. Every other way in — the REST API handlers, the webhook intake, trigger-dispatched runs, retries and async workers — authenticates but does not authorize against the policy chain, and judgement is only reached for connector actions inside a run. A person, or a forged webhook, can start a workflow, read runs or manage sources without anyAuthorizecall, so enforcement exists on one path only and the automation platform is the bypass.Today:
internal/platform/httpapi/httpapi.goguardmiddleware authenticates every API request (session cookie, personal token or bootstrap admin token viaAuthenticatorinmodules/governance/auth.go) and marks operations Public, SignedIn or admin-only, with cross-origin protection; beyond that, per-operation authorization is only chat's owner scoping in SQL plusallowed()'sAccess.Authorize(governance.Live/Engineinmodules/governance) before a tool call.modules/events/events.goRoutes/intakeserves the webhook intake outside the API and verifies only the source token hash —Engine.AuthorizeDeliveryexists inmodules/governance/engine.gobut the new intake never calls it. Runs are started bydispatchandtickinmodules/eventswith no principal and noAuthorizeon the workflow resource;modules/runs/runs.goStartchecks only that the workflow exists and the input validates, and worker execution (Work/execute) judges connector actions with the workflow name as judgement's principal (rc.requestinmodules/runs/dry.go) but never calls governanceAuthorize; retries (deliveriesWorkbackoff, event redispatch, chatsettleActions) re-run with chat re-checkingallowed()inrunApprovedbut runs not re-authorizing. Everything runs in one process with one database role:internal/app/archie/run.gowires all modules into the single binary and grants the runtime role DML on every module schema (schemas), andowner()merely names the process for run leases — there are no separate workload identities and no service-to-service authentication.Source: the revised RFC exported at transcripts/2026-11-20-chat-authorization-rfc-3fa43269.md in sam/archie-product; citations below are RFC section numbers.
Required behaviour:
AuthorizeDelivery) per source and address, not only the token (RFC 3 stage 1).Out of scope: tool discovery (#2067), taint (#2068), memory scopes (#2069), connector credential modes (#2070), admin tools refused in chat (#2071), approval binding (#2072), image/CSP (#2073), budgets and rate limits (#2074), audit/revocation/kill-switch (#2075), plus the disclosure-per-audience issue and the chat-triggered-workflows issue filed alongside this one. Beyond those, this issue covers only that every path reaches enforcement — not what the enforcement decides (hard rules, guards, tool manifests).
Design notes: the single authorization seam stays
governance.Live.Authorize(modules/governance/live.go,engine.go); entry-point wiring lives ininternal/platform/httpapi(authentication middleware),modules/events(intake) andinternal/app/archie/run.go(composition root gives every module the authorizer and records the entry surface withWithSource). Seams:httpapi.guard,events.intake,runs.Engine.Start/dispatch,deliveries.Work,chat.Work. Pitfalls: a resumed turn still acts as its owner; never trust model-supplied identity; deny by default; fail closed onErrChainUnavailable(chat'sallowed()already refuses then); background loops must carry an explicit workload principal rather than none (WithoutPrincipalis for the policy loader only). Migration: per-module database roles and grants so the datastore makes the intended path mandatory; no chat-store changes needed.Tests: security-seam table tests with fakes, no DB:
Authorize+judgement path as a chat-initiated action (fake authorizer records both);Done when:
task checkpasses with the new tests. Manual check on a running binary (task dev): fire a trigger and watch the started run's trail show the same authorization decisions as a chat-initiated action; call a workflow-run or source-management endpoint with a low-privilege token and see it refused; revoke a role while a run is suspended and see its next protected step refused on resume.Open questions for the maintainer: this binary is a single process today — should "separate workload identities" mean separate database roles and process-level separation per module within the one binary, or splitting services again, and in which deployment; should source webhooks keep token auth plus per-address delivery policy, or move to signed installation events?
Part of #2066.
Maintainer direction (2026-11-21): not every entry point is gated by authorization, but most (about 90%) are. Working principle: deny by default. Every entry point declares whether it is public, authenticated only, or authorized against the policy chain, and the route table makes the default "authorized". The exemptions are explicit and short:
Still open: whether "separate workload identities" means per-module database roles inside the one binary (recommended, and already planned in #2011) or separate processes.