access: instance service and principal credentials with server-derived scope #1267
Notifications
Due Date
No due date set.
Blocks
Depends on
Reference: sam/archie#1267
Reference in new issue
Block a user
State Store accepts the instance service credential (daemon, Gateway; attributed) and per-identity principal credentials from which it derives org/workspace scope; no request field sets scope; personal API tokens; the single-operator shared token authenticates as owner of default; sign-in provider outage is a distinct health issue. Design: docs/prds/orgs-and-access.md (Approved).
Notes
SCOPING (2026-10-04), from the code. Already done: the shared token acts as owner of default (access.SharedTokenOwner, used by webui and the policy lockout guard); dashboard OIDC sign-in exists (internal/app/archieui/auth.go, internal/infrastructure/oidc). Missing: (1) State Store auth is one admin token for every service plus task grants (staterpc/task_grants.go UnaryInterceptor), so nothing is attributed; policy audit records actor 'archied'. (2) Scope crosses as request fields: org_id on control-plane Query/History/Watch (controlplanerpc/request.go) and package RPCs (webui api_extensions.go passes org.OrgFromContext). (3) No personal API tokens. (4) No sign-in provider outage health issue. Smallest order: per-service tokens with service name on the call (fixes audit actor), then principal credential forwarded by archie-ui so the State Store derives org, then remove org_id request fields (proto breaking; buf breaking needs an accepted break), then personal tokens, then the OIDC health probe.
Step 1 done: every State Store client stamps its service name (state-store-caller metadata); the server puts it on the context after auth (task grants become task/); policy audit records it. Next: step 2, archie-ui forwards the signed-in principal so actor and org come from the credential.
Step 2 done: the State Store client forwards the principal on ctx (state-store-principal metadata); the State Store resolves it with PrincipalFor after auth and sets org, actor and principal on the server context; a task grant's metadata is stripped. Control-plane Query/History/Watch/Command, package RPCs and ListDenials now read org.OrgFromContext, so the org_id request fields are unused. Step 3: delete those fields from proto (buf breaking accept), and take CommandRequest actor from the context (archie-messaging sets actor per chat user, so it must forward that identity first).
Step 3 done: the org_id request fields are gone from control-plane Query/History/Command/Watch, the five package RPCs and ListDenials (numbers and names reserved; buf.yaml ignores FIELD_NO_DELETE for controlplane.proto). Clients take no org (storepkg.Installations, access.DenialRecorder). Still request-supplied: CommandRequest actor/source (messaging writes per chat user) and AccessPolicy.org_id on PutPolicy/DeletePolicy. Next: step 4 personal API tokens, step 5 sign-in provider health issue.
Close reason
All five steps landed: calls are attributed to the calling service; archie-ui forwards the signed-in person and the State Store derives org and actor from it; org request fields removed from the contracts; personal API tokens; a sign-in provider outage is a health issue and no longer stops archie-ui. Request-supplied actor on control-plane writes is filed separately.
Imported from beads
archie-core-cp84· GitHub #1027 · type task · priority P1 · created 2026-09-23 · closed 2026-10-04