Repository navigation
Description
Problem and intended outcome
Agent OS currently resolves secrets through a Value string abstraction and supports AES-GCM sealed credential files with a caller-supplied raw 32-byte key. The sealed-file format does not currently encode an explicit key generation/version, and there is no general rotation/re-key lifecycle.
Separately, the SQLite ledger intentionally stores substantial operational history. The project should explicitly define what protection Agent OS itself promises for data at rest rather than leaving that boundary implicit.
Perform a focused security/design pass that hardens secret/key lifecycle where needed and documents the at-rest threat model before adding encryption mechanisms by assumption.
Current facts
internal/secrets.Valueis a Go string.- credential-directory reads use transient byte buffers and clear them on failure, but conversion to string removes that zeroization property.
internal/secrets/encrypted_file.gouses AES-GCM with an exact 32-byte supplied key.- sealed format is currently
AGENTOS-SEAL-1with nonce+ciphertext and no explicit key-generation identifier. - no general re-key/rotation flow is defined.
A raw random 256-bit key does not inherently require a password KDF. Do not add Argon2/scrypt/HKDF mechanically; first define the actual key source and threat model.
Required decisions
- What are the supported master-key sources and guarantees?
- Should secret values remain Go strings at adapter boundaries, or can lifetime/copying be reduced through a byte-oriented secret type?
- How are sealed credentials associated with a key generation?
- What is the rotation/re-key process and failure/recovery behavior?
- What does Agent OS promise for ledger/database confidentiality at rest?
- Is OS/full-disk protection the supported boundary, or is application-level database encryption required for the intended deployment model?
Acceptance criteria
- Document the supported at-rest threat model and explicitly state what Agent OS does and does not protect.
- Document master-key provisioning requirements and reject weak/ambiguous key material at the supported boundary.
- Define whether
secrets.Value stringremains acceptable; if not, replace it with a bounded-lifetime representation without pretending Go can guarantee complete memory erasure. - Introduce a versioned/key-generation-aware sealed credential format before supporting rotation.
- Define and test rotation/re-keying, interrupted migration, old-key retention window, and rollback/recovery behavior.
- Existing sealed credentials either remain explicitly supported through a bounded migration path or fail with a clear non-destructive compatibility error.
- Decide ledger-at-rest protection explicitly; do not claim application-level encryption unless implemented and verified.
- Secrets/keys remain excluded from ordinary ledger events, telemetry, logs, model context, and error messages.
Priority rationale
This is a real lifecycle/security-design gap, but application-level database encryption should not be assumed to be required until the intended threat boundary is documented.
Ownership boundary: Agent OS is not a KMS or secret-management platform
Agent OS should own the credential/key-use contract, not evolve into a general secret-management or key-management system.
Agent OS should own semantics such as:
CredentialRef/ secret reference identity;- credential/key generation identity;
- intended purpose, audience, and authority scope;
- which exact generation an execution used;
- whether the configured secret provider satisfies the required protection class;
- rotation/change invalidation semantics at the Agent OS boundary;
- durable evidence that a credential/key generation changed;
- exclusion of secret material from model context, logs, ordinary ledger events, telemetry, and errors.
The preferred implementation direction is to use fit-for-purpose external/host secret providers where available, such as:
- systemd credentials;
- OS keyrings/credential stores;
- Vault/KMS/secrets-manager style providers;
- hardware-backed or platform-managed key services where justified.
The existing sealed-file mechanism may remain as a deliberately minimal local provider, but this issue MUST NOT expand it into an Agent OS-specific Vault/KMS with broad key hierarchy, policy, HSM, replication, leasing, or enterprise secret-management features.
If rotation/re-key support is implemented for the local sealed-file backend, keep it only as complex as needed to preserve the Agent OS credential-generation contract and safe migration of that backend.
Revised implementation guidance
- First define the credential/key provider contract and required evidence.
- Prefer external providers that already satisfy generation, rotation, storage, and access-control requirements.
- Keep local sealed-file support minimal and explicitly scoped.
- Do not add application-level ledger encryption merely because Agent OS stores sensitive operational history; first decide whether the supported at-rest boundary is host/OS storage protection or a stronger application-level contract.
- If a stronger application-level at-rest guarantee becomes a real requirement, evaluate a specialized storage/encryption provider before building a custom cryptographic storage subsystem.
Additional acceptance criteria
- The design separates Agent OS credential/key lifecycle semantics from provider-specific storage/encryption implementation.
- At least one provider contract can represent externally managed rotation/generation without requiring Agent OS to possess master-key material.
- The local sealed-file backend is documented as a minimal provider, not the foundation of a general KMS.
- Provider changes/rotation still produce exact generation evidence usable by execution/replay without exposing secret bytes.
- No acceptance criterion requires Agent OS to implement generalized secret leasing, HSM integration, replication, PKI, or enterprise KMS behavior unless a concrete supported need is separately approved.
Core infrastructure provider availability constraint
For secret-management infrastructure that Agent OS itself depends on for safe operation, supported required providers must have a no-cost deployment path. Open-source implementations are preferred.
This does not require every optional commercial/cloud integration to be free. It means Agent OS's baseline safe operation must not depend on purchasing a proprietary secret-management service.
Provider selection should therefore prioritize self-hostable/free options such as systemd credentials, OS-native stores, OpenBao, or other suitable open-source/no-cost systems before paid-only services.
Additional acceptance criteria
- Agent OS has at least one no-cost supported secret-provider path for baseline operation.
- Open-source/self-hostable providers are preferred for first-class core-infrastructure support when they satisfy the contract.
- Paid cloud/KMS integrations remain optional rather than becoming mandatory dependencies for baseline safe operation.
Activity