OpenClaw EnterpriseDOCSGitHub

Secrets, failure behavior, and platform invariants

This chapter defines requirements within the authoritative platform architecture. The implementation status below separates current behavior from remaining design work.

Implementation status

Secret storage, exact binding authorization, revision-scoped delivery, and transactional mutation audit are implemented. With Kubernetes, canonical Secrets live in the tenant control-plane namespace; the worker materializes admitted runtime Secrets for the exact consumer. Model credentials still reach the executing Harness. Brokered model access, OAG audit, universal pre-execution policy enforcement, and mutually authenticated workload transport remain broader design requirements. See Secret storage, runtime isolation, and audit for current behavior.

Secret access

The approved SecretDriver storage and delivery contract uses Installation-selected KubernetesSecretDriver by default. Each Secret belongs to one Namespace, can be created before any Agent exists, and uses a Namespace-unique name. Same-Namespace Agents may consume it only through explicit Agent harness-auth or Configuration bindings and assignment checks; cross-Namespace references are unsupported. Namespace membership, Configuration access, Agent access, or possession of a reference does not grant consumption. OCC stores immutable Namespace/backend metadata without agentId, and the driver stores mutable secret material independently of gateway creation. Protected storage writes may contain plaintext; ordinary responses, OCC persistence, revisions, ConfigMaps, and audit records contain references only.

Default delivery is explicit Kubernetes secretKeyRef environment injection into the selected consumer for an admitted revision. Configuration bindings serve the gateway; Agent harnessAuth serves only the model-executing Harness. Native OpenClaw SecretRefs resolve the embedded environment. The dedicated model-credential boundary keeps keys out of its gateway. Updating a Secret keeps its reference stable and does not restart a workload; the operator redeploys or restarts each consumer that should observe the latest value. Old revisions retain references, not historical values. Admission checks current authorization; Kubernetes process restarts do not reauthorize delivered env values. Immediate loss of access requires stopping the workload or revoking the upstream credential.

Source identity and delivery mode are separate. The optional credential_gateway capability keeps a model credential outside the Harness: a Namespace-scoped CredentialSource registers an OCC Secret with the selected CredentialGatewayDriver, and its paired Sandbox applies the credential to outbound requests while the workload holds only a placeholder. OCC reads the Secret once, at registration, and never stores the value. The current implementation is OpenShell provider substitution for dedicated Codex with an OpenAI API key; while a Credential Gateway is selected, Secret-backed model delivery is rejected rather than used as a fallback. The guarantee relies on the gateway's own membership controls and on enforced Sandbox NetworkPolicy. Update, rotation, per-Agent withdrawal, and other source types are deferred. Environment-delivery guarantees do not describe this path. The project-root ref/design.md remains the external broker-target owner handoff outside this implementation worktree.

Production execution retains scoped direct-credential delivery, because the Credential Gateway path is limited to the unsupported OpenShell Sandbox. The Agent's harnessAuth API-key binding references an OCC Secret in its exact Namespace. The Secret Driver owns storage; Kubernetes projects the source only into dedicated Codex or the combined embedded OpenClaw gateway/Harness. Each consumer requires its own admission and dispatch authorization; the dedicated gateway gets no key.

For a provider-managed account, API-side Kubernetes Compute stores the issued access token and pinned provider workspace in one account-owned Secret in the tenant control-plane namespace. The revision snapshots only the OCC account identity, exact credential reference, and verified private Backend/workspace ownership. The worker materializes the admitted credential into a revision-owned runtime Secret in the data plane, which Kubernetes projects into the associated dedicated Codex workload. Codex logs in with its access token under the forced provider workspace. Its separate gateway never receives the token, workspace, or provider admin credential; embedded access-token execution is unsupported. The API has tenant-local credential provisioning permissions. The worker reads canonical control-plane Secrets and manages revision-owned data-plane Secrets; Agent workloads receive no direct Secret API permissions. A trusted worker with Deployment write access can also indirectly project tenant Secrets, so its effective trust boundary remains each granted tenant namespace. Provider credentials never enter OCC resources, snapshots, routes, or audit records.

Kubernetes Compute now materializes admitted runtime Secrets across the selected Gateway and Harness targets without shared cross-namespace Secret references. The selected SecretDriver owns canonical storage; Compute owns the runtime projections. Logical Secret ownership remains the Agent's Namespace, and existing bindings and consumption checks still apply. See the storage contract.

A trusted dedicated gateway may receive its existing Agent-scoped gateway and Channel credentials and Secrets explicitly bound by its approved Configuration. Its identity boundary excludes dedicated Harness identity and model credentials as well as broad controller credentials. Direct model-credential delivery to the tenant data-plane Harness is a temporary implementation exception. Target model-credential mediation keeps real upstream credentials outside Harness execution; the Harness receives only scoped substitutes. Workload-write authority must be bounded in each target, since it can indirectly expose Secrets there. Cross-target materialization does not establish brokered model access or workload-bound transport authentication; those guarantees remain deferred.

Failure behavior

OpenClaw fails closed when any required boundary or dependency fails:

The selected IAMDriver evaluates each exact request before a side effect. ComputeDriver ensures Namespace infrastructure only after its independently authorized Namespace lifecycle operation. Authorization, reference validation, backing Namespace readiness, selected inference target, and sandbox policy support complete before OCC creates a revision. The Agent-owned gateway is configured and becomes ready during that exact revision's preparation in its selected target, independently of the candidate Harness's placement. A denied request may invoke its authoritative IAMDriver but cannot create a gateway, workload, resource, inference request, or messaging side effect.

If candidate provisioning, containment enforcement, or nonserving route preparation fails, the candidate remains inactive and the previous active revision, Agent workload, and route remain unchanged. Once cutover begins, OCC disables the previous route before activating its replacement. A failure during or after cutover retains the previous workload but leaves routing disabled until the new route succeeds or the previous revision and route can be independently verified and restored.

Rollback and cleanup cover both selected runtime targets and preserve exact ownership; a failed or unreachable target cannot be treated as successful recovery or deletion. OCC never substitutes another runtime target, Namespace, identity, IAMDriver, CredentialGatewayDriver, SecretDriver, gateway, provider, or runtime implementation.

Audit

OAG records identity-verification and admission decisions, their requested scope, and safe denial reasons. OCC records the acting identity, requested action, exact resource, scope, selected IAMDriver, applicable Restrictions, their enforcement outcome, and the result for platform operations. Exported audit events retain the stable Installation identifier at their top level so evidence remains attributable outside the singleton platform; nested resource references retain only their exact resource and applicable Namespace. Deployment audit identifies the candidate and previous active revisions, selected service-account, compute, sandbox, inference, channel, and secret Drivers, Agent-owned gateway and workload operations with nonsecret runtime-target observations, the selected approved model target, readiness decisions, route changes, and any rollback outcome. Audit records contain no credentials, secret values, prompts, provider message contents, or runtime message contents.

Platform invariants

The platform preserves:

Search documentation