b9c1663d64b55e01fe84df54323ec8b2c906e6dd
2
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
605066d835 |
fix(identity): derive the caller the way the provider issues tokens
Infra decoded real tokens from both clients, and two of the three facts changed this code. A machine token carries NO sub at all: it names its caller by client_id, and the identity is that client. A person's token carries sub, the provider's stable identifier for the person. The subject is now derived explicitly -- sub when present, else client_id -- and a verified token asserting neither is refused rather than accepted as an anonymous caller, because accepting it would let any token the provider ever signed act as whoever the binding happened to hold. A machine identity is therefore per client registration, one identity per client, which is what makes per-agent identity a configuration decision rather than a code change. Scopes are read from either claim shape. The standard is a space-delimited scope string and this provider also emits an scp array; reading only one shape yields no scopes at all, which is worse than reading none deliberately. The audience-at-authorisation-endpoint trap is pinned by a test: a token minted without the requested audience arrives with aud empty, and the audience check refuses it. That refusal is correct and the fix is the request the human flow builds, not a weaker check here -- a test now fails if anyone weakens it. The PRD records both as constraints: a person's client and an agent's client are registered separately because a shared registration collapses the distinction the attribution rests on, and a person's token requests the audience at the authorisation endpoint as well as the token endpoint. Verified: task check exit 0; internal/infrastructure/oidc passes, including subject derivation for both token shapes and every refusal. |
||
|
|
921fe30f9f |
docs(prds): settle identity for users, agents and external agents
One identity record covers users, agents, external agents, service accounts and the system. Authentication is delegated to the estate's OIDC provider and attribution stays archie's. Nothing that verifies a credential, issues a session, stores a password or checks a permission is built here, per Sam's hard requirement that authentication and authorisation are OSS archie integrates. Authelia is the only provider, because the estate already runs it in front of the dashboard and it issues credentials for both kinds of caller: authorization code for humans and client_credentials for machines, whose subject is the client's own identifier. Each agent is its own client, so two agents are distinguishable in the audit trail and revocable separately. SPIFFE/SPIRE is rejected on operational fit rather than quality: it is adopted and its attestation is strictly stronger, but it adds a control plane archie does not have and answers a threat archie does not face while its agents run in containers the operator launches. internal/domain/identity survives and is not replaced by the provider's directory, because it carries what the directory does not: lifecycle, bindings and attribution. archie owns the subject binding that ties an identity to the provider subject asserting it -- the same bridge identity_aliases already provides from a legacy name -- plus the lifecycle, the attribution and the identity audit trail. It owns no credential, password, session, token, signing key or permission rule. How an agent proves who it is: it presents a token the provider issued to its own client, archie validates it against the provider's published keys and takes the subject as the acting identity, so an agent holds the secret and archie holds only public keys. A WebMCP tool call cannot be a proof of agent identity and cannot be made one -- a page can invoke its own tools, so an agent's call and a page script's call arrive identically and the difference does not exist on the wire. It is attributed to the identity the request presented with its source as a hint, and it never records that an agent acted or that a human approved. Agent-initiated action therefore arrives on a surface that carries a credential. Task actions gain both attributions: the acting identity, derived from the credential and never from a supplied string, and the authorising principal whose authority the action used. The event kind describes the actor, so KindHumanApproved is recorded only when a human acted; an agent acting under a standing approval records itself as actor and the human as authorising principal. An action with no authorising principal is unattributed rather than attributed to the actor's own authority, and the review gate's approver is the approval's authorising principal, not the surface they used. External agents are first-class: the same record, kind service_account, bound to its own provider client, at the cost of a client registration and a secret to rotate per peer. Authorisation is deferred: no engine, no policy language, no decision point, with the credential's scopes as the only input; the decision point goes behind a single archie interface when per-skill limits are needed. The PRD is a development-audience page, so it regenerates dev-docs.json to 69 pages. Verified: task check exit 0, including docs:prds. |