Access policy edits take up to 30s to reach archied, so a new forbid does not stop runs started meanwhile #1367
Notifications
Due Date
No due date set.
Blocks
Reference: sam/archie#1367
Reference in new issue
Block a user
The dashboard reloads its own access chain on a policy edit, but archied only reloads every applystatus.RestampInterval (30s). Verified: a forbid on the agent identity added seconds before a work request let that run complete; the same request 35s later parked. A deny that does not apply immediately is a security gap. Done when a policy edit is enforced by archied for any run dispatched after the edit returns (e.g. the edit notifies archied to reload, or authorization reads the current chain).
Notes
Acceptance also covers two paths that today reload nothing at all: ResetOrgPolicies/ResetInstancePolicies (internal/app/statestore/access_reset.go:77-79) and EnsureShippedOrgPolicies (internal/infrastructure/staterpc/access.go:137). A fix that pulls freshness per decision makes both correct for free; a push/ticker fix leaves them stale. No workaround (shortened ticker) is acceptable: the guarantee is ordering, not latency. Out of scope: the window between the start-of-task check (internal/daemon/workflow_identity.go:142) and container launch.
Design analysis done; supersedes the max(version) sketch in the previous note.
Mechanism: ONE singleton counter row (new migration), bumped inside the same tx as every policy write, read by the authorizer before each decision; rebuild the engine only when it moved. max() over the existing per-level version rows CANNOT carry the guarantee: an edit outside the currently-max scope is silently missed, DeletePolicy can move max down, and ResetInstancePolicies writes no version at all.
Ordering rule: read version first, then the full policy list (one statement, one snapshot, principal stripped). Over-stamping a newer engine is recoverable; content@4 stamped 5 is stale forever.
Failure policy: fail closed. Version read fails, or list read fails after a bump, refuses with ErrChainUnavailable (an availability failure, not a denial) — never the last chain. Tolerable standing allow: 0s. This forces three fixes: authorizeDispatch must not record an unavailable decision as terminal (daemon.go:663,729), a task start must park transient not NeedsHuman (workflow_identity.go:143), and the tool gateway must not report unavailable as 'may not'.
Open decisions for the maintainer: (1) singleton counter vs max — recommend singleton; (2) fail-closed — recommend yes, a State Store blip stops dispatch instead of standing allows; (3) check-to-launch window out of scope; (4) replace Live rather than wrap it (one type, ticker deleted, three call sites); (5) also fix New()'s per-policy Cedar schema re-parse (sync.OnceValue, halves rebuild) since rebuilds now happen per edit.
Same fix covers ResetOrgPolicies/InstancePolicies and archie-core-cf5mz (gateway) for free: one mechanism, three call sites, one migration.
Close reason
Every decision reads an instance-wide policy revision first and rebuilds when it moved (commit
5c922038); a store failure refuses with ErrChainUnavailable instead of standing on the last chain.Imported from beads
archie-core-i0scw· GitHub #1829 · type bug · priority P1 · created 2026-10-24 · closed 2026-10-25