Introducing a new way to review your PRs.

Read the announcement

jdx / fnox

encrypted/remote secret manager

View on GitHub

27 documents · Updated Nov 23, 2026

docs / audit-commands

Audit commands

The audit command gives operators a local view of secret-related activity handled by fnox. It queries an opt-in record of secret reads and proxy requests without storing secret values, so operators can inspect recent activity while understanding that the log is not complete tamper-proof evidence.

Audit command surface

The audit surface is the read side of the audit system. Secret-reading commands and the credential proxy create records when auditing is active. fnox audit selects those records and presents them for review or machine processing.

The command belongs to the wider command interface. Use secret and config commands for the read actions that create many audit records, provider and diagnostic commands for provider checks, and push target integrations for related downstream secret use.

Command query

fnox audit reads the configured audit log and shows the most recent 20 matching records by default. Operators can narrow the result by secret name, reading command, or provider, and can set the result count with --limit; the selected records are shown from oldest to newest within that result.

Common uses include:

  • fnox audit for a recent activity view.
  • fnox audit --secret DATABASE_URL -n 5 for one secret.
  • fnox audit --command mcp for reads made through the MCP server.
  • fnox audit --command proxy for requests handled by the credential proxy.

The secret filter also matches names injected into proxy requests. This lets an operator find proxy activity linked to a secret even though proxy records use request details instead of a single secret field.

References: src/…/audit.rs• L25-49 src/…/audit.rs• L58-67

Output formats

Human-readable output gives the time, command, and profile for each record. A normal secret-read record also shows its secret, provider, and daemon-cache marker. A proxy record shows the request method, destination, path, injected secret names, or refusal reason.

--json emits one JSON object per line. This keeps the full audit record available to tools such as jq. --path prints the active log path and exits. Control characters in human-readable proxy fields are escaped so a logged request cannot rewrite the terminal.

If no records match, the command exits successfully. In human-readable mode it explains whether the log is empty or auditing is off. JSON mode emits no explanatory status line, so it remains safe for machine use.

References: src/…/audit.rs• L51-57 src/…/audit.rs• L70-135 docs/…/audit.md• L15-43

Audit record lifecycle

An audit record represents activity handled by fnox. Secret-read records describe resolved secret reads. Proxy records describe requests served or refused by the credential proxy. Neither record type stores secret values, request headers, request bodies, query strings, or environment contents.

Read event flow

The flow connects a secret-related action to a local record and then to an operator query. Audit write failures do not fail the underlying secret read or proxy request, although records can be lost when storage or the audit writer cannot keep up.

flowchart LR
    A[Secret read or proxy request] --> B{Auditing enabled?}
    B -- No --> C[No audit record]
    B -- Yes --> D[Create activity record]
    D --> E[Append to local JSON-lines log]
    E --> F[fnox audit filters and displays records]

Secret reads can come from direct commands such as get and exec, or from indirect readers such as shell integration, MCP, proxy use, checks, exports, and the TUI. A read of an interpolated secret records the secret that the resolution process read. Proxy activity uses a separate request record that names the request context and injected secrets.

References: crates/…/audit.rs• L1-8 crates/…/audit.rs• L234-273 crates/…/audit.rs• L56-76

Record fields

Each JSON line contains operator-facing facts about one activity event:

FieldMeaning
tsUTC time in RFC 3339 form.
commandThe fnox command or service that handled the activity.
profileThe active profile set.
configThe configuration file that defines a secret read. It is empty for proxy records.
secretThe secret name. It is empty for proxy records.
providerThe provider used for a secret read, or null when no provider applies.
cachedWhether a daemon supplied a secret from memory.
requestProxy request details when the record came from the credential proxy.

The request object can contain the method, destination domain, path, injected secret names, and a refusal reason. A refused request has no injected secret list from a served request, while a served request has no refusal reason. The record never contains a secret value.

References: crates/…/audit.rs• L17-54 docs/…/audit.md• L30-42

Audit storage and trust boundary

The audit log is a local file controlled by the current user. It is designed to show what fnox recorded during normal operation, not to prove that every secret-related action by the account occurred.

Enablement and log location

Auditing is off by default. Operators enable it with [audit] enabled = true or FNOX_AUDIT=on; the environment setting takes precedence over the configuration setting. The log path uses FNOX_AUDIT_PATH first, then [audit] path, then audit.log in the fnox state directory.

Keep the audit setting in trusted global configuration when possible. A project configuration can select a log path, so an untrusted project should not decide where the user's audit records are written.

References: crates/…/audit.rs• L204-225 src/…/audit.rs• L71-79 docs/…/audit.md• L11-24

Record integrity

The log is appended as JSON lines and new files use owner-only permissions on supported Unix systems. fnox does not rewrite or truncate prior records, but the account that owns the file can still edit or delete it. Activity that reads a provider or key without using fnox is outside this record.

The audit writer can queue records so slow storage does not stall the main operation. If its queue is full or its process ends before queued records are flushed, some activity can be missing. Use the log for review and unexpected fnox activity. Send copies to a system that the account cannot rewrite when an audit trail must survive a compromised process.

References: crates/…/audit.rs• L79-82 crates/…/audit.rs• L142-200 crates/…/audit.rs• L283-301 docs/…/audit.md• L61-71

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep the audit command filters aligned with both secret-read fields and proxy request injection fields.
  • Keep JSON output line-oriented and preserve the full request shape for machine readers.
  • Keep every secret-reading path and proxy lifecycle connected to the shared audit record flow.
  • Preserve the rule that audit failures do not change the result of the secret read or proxy request.
  • Review path precedence and trusted configuration guidance when audit settings change.

Important failure modes

TriggerConsequenceGuard
Auditing is not enabledSecret reads and proxy requests produce no audit records.Enable [audit] enabled = true or FNOX_AUDIT=on.
The log path cannot be writtenThe operation still succeeds, but activity is absent from the log and fnox warns.Check the path and its directory permissions.
The audit writer queue fills or shutdown ends before flushSome queued activity is not recorded.Use writable, responsive storage and allow the writer to flush at shutdown.
A project chooses the audit pathRecords can be written to an unexpected location.Set the audit path in trusted global configuration or use FNOX_AUDIT_PATH.
A daemon serves a cached secretThe provider is not called, which can look different from a fresh read.Inspect the cached field in JSON output.
A process reads a secret outside fnoxNo audit record is created.Treat the local log as fnox activity, not complete account evidence.

Key files

FileWhy to read it
src/…/audit.rsDefines the operator command, filters, output modes, and empty-log behavior.
crates/…/audit.rsDefines audit records, enablement and path rules, append behavior, queued writes, and record queries.
src/daemon.rsShows how resolved reads, dependencies, and cache status enter the shared audit flow.
docs/…/audit.mdGives the operator view of setup, record meaning, and the trust boundary.
docs/secret-and-config-commands.mdProvides related command context for direct secret reads that can create audit records.
docs/push-target-integrations.mdProvides related context for systems that may consume or act on secret-related data.