d4e254b3494de7ce47477b9421e8c8d3e035e104
5
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
b5b0400496 |
fix(webui): send a refused browser to sign in, and drop an unused method
Two loose ends from the sign-in work, both mine. A browser that cannot authenticate now goes to the provider when this instance has a sign-in flow, instead of being shown the shared-token paste page -- a page that cannot help it, because the token it would paste is not what this instance accepts. A refusal that signing in again cannot fix, a suspended identity, is still answered rather than redirected: sending someone back to a provider that already authenticated them would hide the reason they were refused. ProviderSession.Expired is removed. Nothing called it, and it must not: expiry is the verifier's check, and a second opinion about whether a token is still good is exactly the sort of near-duplicate that drifts from the authority it copies. The browser path re-runs the flow when verification refuses, which is one rule rather than two. Verified: task check exit 0 on this tree. |
||
|
|
c53b2fee60 |
feat(webui): let a person sign in and act as themselves
The last gap in the identity boundary: enabling a provider used to lock browsers out, because nothing could turn a sign-in into the credential the dashboard already verifies. Now a browser completes the authorization code flow with PKCE and the identity reaching the request context is the person who signed in. The audience is requested AT THE AUTHORIZATION ENDPOINT, not only at the token endpoint. Infra measured that a provider asked otherwise returns the audience empty, and this dashboard then refuses a perfectly valid token -- a failure that reads as a signing fault and is actually a missing query parameter. A test asserts the parameter is present, so it cannot quietly go missing. The flow is the libraries': discovery, the code exchange, PKCE generation and the challenge transformation are go-oidc and x/oauth2, so archie writes no protocol. The token returned by the exchange is verified through the SAME Verifier a presented token goes through, and the identity is then resolved through the same rule -- one Resolve now shared by Authenticate and the callback, so a browser sign-in cannot be accepted on terms a presented token would be refused on. Archie still issues no session. The callback stores the PROVIDER's token in an HttpOnly cookie and every later request re-verifies it, so what archie holds cannot outlive the provider's own decision. The callback checks the state it issued, and expires the state and PKCE verifier cookies on use. The sign-in routes mount on the bypass mux because they are how a caller becomes authenticated; gating them behind the credential they obtain would make signing in impossible. The client secret is never a flag: -oidc-client-secret-env names the environment variable holding it, so it cannot reach a process listing or a log line. No client id means no sign-in route and token verification is unaffected, which is what an agent-only deployment wants. Evidence, produced by driv·ng the flow rather than the seam: internal/webui/api_tasks_actor_test.go's TestBrowserSignInRecordsTheSignedInPerson walks sign-in -> callback -> cookie -> action and asserts the recorded actor is the signed-in person with human_approved. TestCallbackRefusesAMismatchedState asserts a replayed state is refused before any credential is verified. internal/infrastructure/oidc/flow_test.go runs the real flow against a test provider's own authorize and token endpoints, asserting the audience parameter, the PKCE challenge, a successful exchange, and a refused wrong verifier. Verified: task check exit 0 on this tree. |
||
|
|
369ae695d4 |
feat(webui): verify a provider credential on a request path
The verifier was a library nothing called. A request now carries a credential or is refused: webui.Server.Authenticate resolves a presented bearer token to the identity that may act, and requireIdentity attaches it to the request context. With a provider configured that check replaces the shared token, so every request resolves to a named identity or is refused; with none, the shared-token gate stays for a loopback instance. Nothing about the caller is read from the request. The subject comes from the credential the provider signed and the identity is the record that subject is bound to, which is what makes attribution possible at all: a caller cannot assert who it is, it can only present what the provider gave it. A test sends an X-Archie-Identity header and an actor field in the body alongside a valid token and asserts the resolved identity is still the credential's. Refusals follow HTTP's own distinction: absent or unverifiable credentials are 401 and name the scheme, while a credential that verified for an identity that may not act is 403. Each is covered, because a refusal path with no test is a path nobody has watched refuse. The two state-store RPCs the dashboard needs to resolve a subject exist: ResolveIdentitySubject and BindIdentitySubject, with the client implementing identity.SubjectBinding (a narrower contract than Repository, so the administrative facade keeps its shape) and the server answering Unavailable rather than pretending when a process has no binding store. chat.proto carries the actor for the next step: actor_id, actor_kind and principal_id on ApplyOperatorTaskActionRequest, regenerated here. The transport can now carry an attribution and nothing fills it yet, which is why the dashboard still records task_approved rather than a human attribution. Not wired in production yet, and worth stating plainly: dep.Authenticate is a seam nothing sets, because the dashboard is served only by the UI process and that process is documented to take endpoint references only -- there is deliberately no config.Config in it. OIDC settings must therefore arrive as flags there, which is an existing design boundary I did not want to cross unilaterally. config.Oidc exists so the daemon-side wiring has somewhere to read from. Verified: task check exit 0 after this commit; focused webui run records the resolution and all four refusals. |
||
|
|
2cc605ae09 |
feat(identity): verify provider tokens and attribute task actions to their actor
Two halves of one boundary: a credential resolves to an identity, and an action records which identity acted and whose authority it used. resource server. internal/infrastructure/oidc verifies a provider-issued bearer token against the provider's published keys, using an OSS OIDC library: archie compares no signature, validates no claim and rotates no key itself, holds no client secret and issues no session, so a compromised archie cannot mint an identity. Audience is required rather than optional -- a token minted for another service must not authenticate here -- and discovery happens at construction, so an unreachable provider is a startup failure rather than a request-time surprise. identity.Authenticate is the single place a credential becomes an identity, and it refuses in four distinguishable ways: no credential presented, a credential that did not verify (wrong key, expired, wrong issuer, wrong audience, malformed), a verified subject with no identity bound to it, and an identity that may not act. The order is deliberate: verification happens before any field of the token is used, so nothing an unverified token carries can select an identity. A suspended identity is refused even though its credential verified, because suspension is archie's decision and must not depend on the provider withdrawing a token. The binding is the second bridge beside the legacy-name alias: identity_subjects keys (issuer, subject) so the same subject string from another issuer is a different caller, and rebinding moves a subject so two identities can never claim one provider subject. The contract Authenticate needs is SubjectResolver, narrower than Repository, so a consumer that only authenticates does not take the whole identity CRUD surface -- and staterpc.Client, which asserts Repository, does not need a new RPC to satisfy it. attribution. taskactions now records two identities per action: the acting identity and the authorising principal, both on the event row as new columns added through the existing migration table. The rule that the bug turned on is enforced by the event kind describing the actor: a person's approval is human_approved, an agent's is agent_approved, and an action with no verified actor is task_approved, a task-level event that credits nobody. An agent acting under a person's standing approval records itself as the actor and that person as the principal, so "approved by came from me" is answerable from the record rather than asserted. Scope and actor are separated: scope decides which task a caller may touch and is never promoted into an actor, because the dashboard's credential is a shared token and possession of it is not evidence that a person was at the keyboard. That last point is a deliberate fidelity trade, and the reason the transport is not wired: the dashboard action path passes no actor yet, so dashboard approvals are now recorded as task_approved rather than claimed as a human's. Recording nothing false is the requirement; naming the human verifiably needs the dashboard to authenticate a token and resolve it, which needs two new state-store RPCs (ResolveIdentitySubject, BindIdentitySubject) -- the next piece, not a rewrite: the verifier is a one-method interface, so introspection would be a second implementation of it. Verified: task check exit 0; focused runs recorded in the handoff. Opaque authelia_at_ tokens were inspected rather than assumed and cannot be verified against public keys; infra is configuring access_token_signed_response_alg RS256 on the archie client, with audience https://archie.catlow.cloud and issuer https://auth.catlow.cloud. |
||
|
|
02720c8e81 |
feat(controlplane): runtime administration over the State Store's gRPC server
The Web UI and messaging channels now read and write Archie's runtime settings through one versioned, audited control-plane API hosted on the State Store's existing gRPC server: catalog, query, command, watch. Each feature owns its resource, validation and commands; storage only writes versions and audit records. Workflows move with it. Definitions become portable YAML compiled through a closed, typed step registry and stored as a control-plane resource, so the yaegi interpretation paths (internal/gate, wfeval, wfextract, gateeval, gateextract, skillbuild) are deleted rather than carried. The UI process reads definitions as data: the JSON projection lives in internal/domain/workflow/task so a dashboard decodes the stored collection without linking the workflow engine, which cmd/archie-ui's deletion gate forbids. Shipped definitions ride the catalog descriptor rather than a bespoke REST route, keeping the API to its four operations. archie-messaging gains -state-store-target/-state-store-token and reads channel settings from the database, failing closed when the State Store is unreachable: the database is authoritative for those settings. |