# NIST SP 800-53 Rev 5 Mapping

aquaman maps to **NIST SP 800-53 Rev 5** control families that govern authentication, access enforcement, key management, and audit. Same evidence applies to **NIST CSF 2.0** (`PR.AA-*`, `DE.AE-*`) and **SOC 2 Common Criteria** (CC6.1 logical access, CC6.6 transmission, CC7.2 system monitoring).

| Control ID | Family | aquaman feature | Test |
|---|---|---|---|
| **IA-5** | Authenticator Management | Eight vault backend implementations (Keychain, 1Password, HashiCorp Vault, KeePassXC, encrypted-file, systemd-creds, Bitwarden, Keeper). Credentials are stored, rotated, and accessed via the vault's native APIs. With the `encrypted-file` backend the vault is aquaman's own file, encrypted with AES-256-GCM under a password-derived key ([BSI TR-02102-1 mapping](https://aquaman.sh/docs/0.18.2/compliance/bsi-tr-02102.md)). | [`test/compliance/nist/ia-5-authenticator-mgmt.test.ts`](https://github.com/tech4242/aquaman/blob/v0.18.2/test/compliance/nist/ia-5-authenticator-mgmt.test.ts) |
| **AC-3** | Access Enforcement | Per-service request-policy engine evaluates method + path against allow/deny rules *before* credentials are injected. Denied requests return 403 and never reach the upstream provider. Policy is evaluated over every reading of the request the proxy knows an upstream might apply (path case for deny rules, encoded slashes, `;params`, method-override headers and `_method`, `X-Original-URL` and `X-Rewrite-URL`); the spellings it does not cover are listed in the test. The UDS path is gated by `0o600` socket-file permissions; the opt-in loopback listener (Hermes path) is gated by a per-install token (constant-time compare) — requests without a valid token get 401 before any credential work, and `/_health` is the only exemption. | unit: [`ac-3-access-enforcement.test.ts`](https://github.com/tech4242/aquaman/blob/v0.18.2/test/compliance/nist/ac-3-access-enforcement.test.ts) + integration via [`t0012-valid-accounts.test.ts`](https://github.com/tech4242/aquaman/blob/v0.18.2/test/compliance/atlas/t0012-valid-accounts.test.ts) (403 round-trip) + loopback token gate in [`loopback-listener.test.ts`](https://github.com/tech4242/aquaman/blob/v0.18.2/test/compliance/loopback-listener.test.ts) + every spelling of a denied request in [`policy-evasion.test.ts`](https://github.com/tech4242/aquaman/blob/v0.18.2/test/compliance/policy-evasion.test.ts) |
| **AC-6** | Least Privilege | The broker endpoint (v0.12.0+) materializes credentials per tool call with a short-lived TTL (default 60s, max 3600s). The agent's shell environment holds the credential only for the duration of one command, not for the agent process lifetime. The `aquaman-hermes` plugin observes least privilege from the other side: it consults only `*_BASE_URL` env vars, never `*_API_KEY` — it has no need for, and no access to, the credential. | covered by `AC-3` test + broker tests in `test/e2e/credential-proxy.test.ts` + [`hermes/tests/test_compliance.py`](https://github.com/tech4242/aquaman/blob/v0.18.2/packages/hermes/tests/test_compliance.py) |
| **SC-12** | Cryptographic Key Establishment & Management | Vault backends are operator-chosen and operator-managed. aquaman delegates key management to the chosen backend (Keychain, Vault, etc.). The exception is `encrypted-file`, where aquaman derives the key from the user's password itself ([parameters](https://aquaman.sh/docs/0.18.2/compliance/bsi-tr-02102.md)). | covered by `IA-5` test |
| **SC-28** | Protection of Information at Rest | Audit log is written `chmod 0o600` to `~/.aquaman/audit/current.jsonl`. Credentials at rest live in the vault backend (operator-chosen encryption). aquaman's own writes (auth-profiles.json, config.yaml) use `0o600`. | [`test/compliance/nist/sc-28-protection-at-rest.test.ts`](https://github.com/tech4242/aquaman/blob/v0.18.2/test/compliance/nist/sc-28-protection-at-rest.test.ts) |
| **AU-2** | Event Logging | A forwarded request, a policy denial, a broker read, a broker refusal, the outcome of a credential-request dialog and an OpenShell driver operation each write one entry. An entry records the time, the service, the operation (`use`, `read` or `rotate`), whether it succeeded and, for a failure, the error text: a policy denial's names the method and path, a broker refusal's names the reference. It does not record the key name of a successful use, the method, path or status of a forwarded request, or which listener the caller used, and a request refused before a service is known (a missing loopback token, a rejected `Host` header or request target) writes no entry. A value is handed out only after its entry is written: if the write fails, a broker read and an OpenShell resolve are refused, a forwarded request's response is withheld, and the daemon keeps running. Loopback requests go through the same audited path as the Unix socket. | [`audit-fail-closed.test.ts`](https://github.com/tech4242/aquaman/blob/v0.18.2/test/compliance/audit-fail-closed.test.ts) (no value without an entry) + [`au-10-tamper-evident.test.ts`](https://github.com/tech4242/aquaman/blob/v0.18.2/test/compliance/nist/au-10-tamper-evident.test.ts) (an access writes an entry) + loopback path in [`loopback-listener.test.ts`](https://github.com/tech4242/aquaman/blob/v0.18.2/test/compliance/loopback-listener.test.ts) |
| **AU-9** | Protection of Audit Information | Each entry carries the hash of the entry before it, and its own hash covers both (SHA-256). `aquaman audit verify` detects an entry that was altered, inserted, reordered or deleted inside the log. It does not detect a log cut short at the end, emptied, deleted, or rebuilt after entries were removed: the hash is unkeyed and nothing outside the file records the entry count or the last hash, so a process running as the user that rewrites the whole log is not detected. A running daemon holds the last hash in memory, so a tail removed under it shows at its next write. Rotated archives are not verified. The log is `0600` in a `0700` directory. | [`au-9-au-10-tampering.test.ts`](https://github.com/tech4242/aquaman/blob/v0.18.2/test/compliance/nist/au-9-au-10-tampering.test.ts): one row per attack; the four undetected ones are `it.fails` rows |
| **AU-10** | Non-repudiation | Partial. The chain is integrity evidence for the entries it links, within the limits stated under AU-9. It is not non-repudiation in the control's sense: an entry names no individual actor (`agentId` is `system`, or `openshell` for the OpenShell driver), and the chain is neither signed nor keyed. | [`au-9-au-10-tampering.test.ts`](https://github.com/tech4242/aquaman/blob/v0.18.2/test/compliance/nist/au-9-au-10-tampering.test.ts) + [`au-10-tamper-evident.test.ts`](https://github.com/tech4242/aquaman/blob/v0.18.2/test/compliance/nist/au-10-tamper-evident.test.ts) |
| **SI-10** | Information Input Validation | Secret-pattern redactor scrubs known credential shapes (AWS, GitHub, Stripe, Slack, OpenAI, Anthropic, JWTs, PEM private keys, …) from agent inputs/outputs. Service names + key names validated against safe regex before vault lookup. The Hermes `aquaman_status` tool/command validates its *output* discipline too — it surfaces only non-secret metadata (origin host:port + env var names), never the token or a key value. | [`si-10-input-validation.test.ts`](https://github.com/tech4242/aquaman/blob/v0.18.2/test/compliance/nist/si-10-input-validation.test.ts) + output discipline in [`hermes/tests/test_compliance.py`](https://github.com/tech4242/aquaman/blob/v0.18.2/packages/hermes/tests/test_compliance.py) |

## SOC 2 Common Criteria mapping

| SOC 2 CC | NIST equivalent | Same evidence applies |
|---|---|---|
| **CC6.1** Logical access — restrict access to information assets | IA-5, AC-3, AC-6 | Yes |
| **CC6.6** Transmission of sensitive information | SC-12, SC-28 (in-transit covered by UDS + chmod 0o600 + operator-chosen TLS to upstream) | Yes |
| **CC7.2** Monitor system for unauthorized activity | AU-2, AU-9, AU-10 | Yes |

## What this is not

- Not an audit certification (SOC 2 / ISO 27001 / FedRAMP / etc.). Those require a third-party assessor.
- Not a complete control implementation — aquaman is a *component* that contributes evidence to those controls. The end-to-end control evaluation depends on how the operator deploys aquaman (vault backend choice, policy config, OS-level access to `~/.aquaman/`, etc.).
- The `aquaman-hermes` Python plugin contributes evidence only as a credential-free status/health layer. It enforces no control itself; the loopback isolation is proxy-side. Its conformance tests assert it does not *undermine* the proxy's guarantees (no credential held, harvested, or logged), not that it implements them.
- The daemon's credential cache (v0.13.1+) keeps vault-fetched values in proxy memory for a bounded TTL (default 15 min for 1Password/Bitwarden/Vault, else off; `cacheTtlSeconds: 0` disables). It is memory-only (SC-28 unaffected), sits behind policy enforcement (AC-3), emits audit events per request rather than per backend fetch (AU-2), and write-invalidates so vault rotation via aquaman is immediate (IA-5). Conformance: [`test/compliance/cache-residency.test.ts`](https://github.com/tech4242/aquaman/blob/v0.18.2/test/compliance/cache-residency.test.ts).

## References

- NIST SP 800-53 Rev 5: https://csrc.nist.gov/pubs/sp/800/53/r5/upd1/final
- NIST CSF 2.0: https://www.nist.gov/cyberframework
- SOC 2 Trust Services Criteria: https://www.aicpa-cima.com/resources/landing/system-and-organization-controls-soc-suite-of-services
- For a machine-readable evidence report, run `vitest run test/compliance/nist/ --reporter=json`.
