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 / command-interface

Command-line interface

The fnox command-line interface is the main way to manage secrets and their configuration. It combines local secret work with provider administration, checks, audit review, short-lived credentials, and publishing to deployment systems.

Command model

The CLI exposes one fnox command with shared options and a required command group. The selected command uses the active profiles and configuration context, then performs a focused read, write, diagnostic, or hand-off action.

Global invocation context

Global options select the configuration and profiles for an invocation. They also control the write target, missing-secret behavior, prompts, output style, and daemon use. The default configuration is fnox.toml; when several profiles are active, later profiles overlay earlier profiles. Write commands use --write-profile when the active profiles do not identify one clear place to save a change. References: src/…/mod.rs• L80-146

Command routing

The router separates commands that can run without a loaded configuration from commands that need the effective configuration. This keeps setup, version, completion, file-discovery, daemon, and usage actions available before a project is ready, while secret and provider operations use the selected configuration.

The normal command path follows this sequence:

flowchart TD
    A[fnox invocation] --> B{Completion request?}
    B -->|Yes| C[Return completion output]
    B -->|No| D[Parse global options]
    D --> E[Select subcommand]
    E --> F{Needs configuration?}
    F -->|No| G[Run standalone action]
    F -->|Yes| H[Load effective configuration]
    H --> I[Run selected action]
    G --> J[Print result or error]
    I --> J
    C --> K[Exit]

The router prepares shared settings and output behavior before the command runs. It validates the active profiles before most configuration-backed actions. Write commands such as set and import also resolve and validate the profile that will receive the change. Provider creation can start without the full project configuration, audit reading can fall back to audit settings, and fnox mcp can relay to a proxy without loading configuration in the child process. References: src/…/mod.rs• L336-451

Secret and configuration workflows

Secret and configuration commands cover the normal lifecycle of a secret. They create configuration, change declarations, resolve values, move values into other forms, and maintain local protected copies.

For detailed command behavior, read Secret and configuration commands.

Secret lifecycle

The main workflow moves from setup to change, use, and maintenance. Commands first form an effective view from the active profiles, then perform one operation on that view.

WorkflowPurposeRepresentative commands
SetupCreate or inspect a starting configurationinit, edit, config-files, profiles
Secret changesAdd, update, remove, or move declarationsset, remove, import, export
Secret useRead values or pass them to another processget, list, exec, env
File useManage secret-backed filesfiles, set --file, get --file, edit --file
Configuration checksFind missing values and likely exposurescheck, scan, doctor
Provider maintenanceCreate protected local copies or refresh themsync, reencrypt
Deployment publishingSend resolved values to write-only targetspush

The same effective view supports interactive work and automation. A write can store a value through a provider, a read can resolve it from a provider or a short-lived lease, and an export or process command can pass it to another system. References: src/…/mod.rs• L45-58, src/…/set.rs• L309-345, src/…/get.rs• L58-151, src/…/export.rs• L106-237

Configuration initialization

The init command creates a project or global configuration without replacing an existing file unless --force is used. It creates missing parent directories for the selected path. In an interactive terminal it can guide a user through provider selection, connection testing, and an optional example secret; non-interactive use or --skip-wizard creates a minimal configuration without a provider. References: src/…/init.rs• L9-18, src/…/init.rs• L40-100, src/…/init.rs• L103-178

Configuration-file discovery

The config-files command explains which configuration files fnox will use. Normal discovery walks upward from the current directory until it reaches the configured root. An explicit path reports that file and its imports instead of performing the upward search. This makes the command useful for separating file-discovery errors from secret and provider errors. References: src/…/config_files.rs• L20-79, src/…/config_files.rs• L84-139

Secret reads and writes

The set command changes a secret declaration or value. It accepts input from a prompt, standard input, a file, or a generator, then stores the value with the explicit provider, the secret's current provider, or the profile's default provider. Encryption providers keep protected data in configuration, remote providers keep a provider key there, and no provider leaves a plain value. When a remote provider changes, fnox uses the existing remote key only if it belongs to that provider; otherwise it starts with the secret name or an explicit --key-name. Metadata-only changes do not need a new value.

A write to an inherited secret creates a local override in the selected write profile, while --config, --global, --walk-up, and --write-profile determine where that override is saved. The command can also generate values, encode values, open a recorded URL before prompting, or manage a secret-backed file. The get command resolves one secret for display, including values produced by a configured lease backend, or returns the content of a secret-backed file. --refresh bypasses the daemon cache for a secret read. export, env, and exec reuse this resolved view for structured output, process environments, and child processes. References: src/…/set.rs• L10-24, src/…/set.rs• L120-133, src/…/set.rs• L310-326, src/…/set.rs• L439-469, src/…/set.rs• L481-637, src/…/get.rs• L9-18, src/…/get.rs• L58-70, src/…/get.rs• L82-145, src/…/get.rs• L287-434, src/…/env.rs• L9-37, src/…/exec.rs• L11-29

Secret import and removal

The import command moves values from dotenv, JSON, YAML, or TOML input into an encryption-backed configuration. It can filter or prefix names, validate them before provider work, preview the change, and preserve metadata for existing entries. It requires an encryption-capable provider; remote-only providers are not import targets. Stdin input needs --force or --dry-run because it cannot also answer the confirmation prompt. References: src/…/import.rs• L12-37, src/…/import.rs• L84-135, src/…/import.rs• L137-194, src/…/import.rs• L254-300

The remove command deletes a secret declaration from the selected configuration while preserving comments and formatting. It can also remove a secret-backed file declaration with --file; that action does not delete the file content or a value stored in a remote provider. References: src/…/remove.rs• L5-11, src/…/remove.rs• L43-93, src/…/remove.rs• L97-155

Secret listing

The list command gives a view of declarations in the merged active profiles. It shows where each value comes from and can include source files or resolved values; it does not resolve secrets unless --values is requested. Its completion mode returns only secret names. References: src/…/list.rs• L12-18, src/…/list.rs• L110-170

Editor workflow

The edit command provides an interactive way to review or change secret values while keeping the configuration's user-written structure. A whole-file edit uses a private temporary copy with resolved values, then writes changed values through their providers; a key edit limits exposure to one value. Read-only provider values can be viewed but cannot be changed. References: src/…/edit.rs• L31-47, src/…/edit.rs• L125-263, src/…/edit.rs• L266-421

Secret-backed files

Secret-backed files let fnox treat a path as a managed secret value. The file commands list declarations, edit their content, resolve it, and write each selected file to its declared path with restrictive handling. files write resolves every selected file before it writes any file, uses mode 0600, and replaces a symlink at the destination instead of following it. References: src/…/files.rs• L10-18, src/…/files.rs• L40-89, src/…/files.rs• L110-159, src/…/files.rs• L391-435

Protected local copies

The sync command copies selected values from source providers into an encryption-capable target. The encrypted copy is stored as sync data, while the original provider reference remains the source of truth for later refreshes. The target can be the project configuration, global configuration, or an adjacent fnox.local.toml or .fnox.local.toml file.

The command also caches secret-backed files in the configuration that declares them. It can filter by key, source, or pattern, preview the plan, and ask for confirmation. A full local-file sync removes obsolete shared cache copies and clears obsolete cache data from personal entries while keeping the personal entry. It reads raw source values with their dependencies, encrypts selected values before writing, and skips values that cannot be resolved. References: src/…/sync.rs• L14-30, src/…/sync.rs• L47-81, src/…/sync.rs• L126-203, src/…/sync.rs• L260-301, src/…/sync.rs• L303-435, src/…/sync.rs• L537-619, src/…/sync.rs• L666-737

Provider re-encryption

The reencrypt command refreshes stored ciphertext with the current settings of an encryption provider. It also refreshes secret-backed files when selected by the operation and clears stale sync data so a later sync can rebuild it. References: src/…/reencrypt.rs• L12-26, src/…/reencrypt.rs• L86-99, src/…/reencrypt.rs• L244-547

Provider and diagnostic workflows

Providers supply the systems that store, retrieve, or protect values. Diagnostic commands report whether those providers and the surrounding configuration are ready for use.

For detailed provider and diagnostic behavior, read Provider and diagnostic commands.

Provider management

The provider command manages named provider entries. It can add, discover, list, test, or remove a provider; without an action, it lists the effective providers. provider add creates a definition from the supported provider catalog and writes it to the project or global scope. An explicit CLI profile or --write-profile selects a profile section; ambient profile settings do not change the default top-level write. Most provider types start from a template that the user edits, while hardware-backed types run setup instead of using only a template. Lua providers can name their plugin at creation time, and Proton Pass providers can set their default vault. The aws and gcp choices create the corresponding AWS and Google Secret Manager provider entries. References: src/…/mod.rs• L18-24, src/…/mod.rs• L129-163, src/…/add.rs• L8-17, src/…/add.rs• L31-50, src/…/add.rs• L52-107, src/…/add.rs• L421-450, src/…/add.rs• L454-468

Provider item discovery

The provider discover command reads item metadata from a supported provider without changing fnox configuration or exposing secret fields. It currently supports 1Password and can list all items in the configured scope or filter them by tags. Terminal output is tabular; JSON output supports tools. If authentication is required, the command can prompt and retry the lookup. References: src/…/discover.rs• L7-12, src/…/discover.rs• L25-77, src/…/mod.rs• L143-160

Diagnostic tools

Diagnostic commands answer different questions about the same operating context:

  • doctor gives a broad report of configuration, secrets, providers, and health.
  • check validates provider-backed secrets without printing their values. It reports missing sources, unknown providers, provider configuration failures, and resolution failures according to each secret's if_missing policy.
  • scan looks for likely plaintext secrets or active secret values in files.
  • schema, completion, and usage expose contracts for tools and shells.
  • ci-redact resolves sensitive values only inside a detected CI environment and emits vendor-specific log-mask instructions where the vendor supports them. GitHub Actions supports runtime masks; unsupported or unknown vendors fail with guidance to use their own protected-variable settings. Multiline GitHub values are warned about because they cannot be fully masked by the emitted command.

check --all includes secrets normally treated as optional, and --strict turns warnings into errors. These commands inspect or describe state. They do not become alternate paths for changing a provider or configuration. References: src/…/check.rs• L9-27, src/…/check.rs• L47-55, src/…/check.rs• L62-79, src/…/doctor.rs• L13-28, src/…/scan.rs• L27-43, src/…/schema.rs• L5-15, src/…/ci_redact.rs• L11-25, src/…/ci_redact.rs• L26-74, src/…/ci_redact.rs• L76-111

Deployment publishing

The push command publishes resolved secrets to write-only deployment targets such as CI systems and hosting platforms. It treats fnox configuration as the source of truth because those targets cannot be read back.

For target types and deployment behavior, read Push target integrations.

Target publishing

Each secret can name one or more push targets. The command builds and validates a plan before resolving values, then resolves required dependencies and groups values by target for delivery. --dry-run shows the plan without reading secret values, while a normal run asks for confirmation unless automation uses --force. It reports successful and failed writes together when only part of the operation completes. References: src/…/push.rs• L10-17, src/…/push.rs• L45-155, src/…/push.rs• L158-209

Auditing workflows

The audit command gives operators a local view of secret access without recording secret values. It complements validation and support commands by showing how fnox was used rather than changing configuration or provider state.

For filters and output behavior, read Audit commands.

Access audit

The audit command reads the local access log and shows recent reads with time, command, profile, provider, and cache status. Proxy request entries also show the request method, domain, path, injected names, or refusal reason. Filters support command, provider, and secret; output can use JSON lines or show the log path. Because the log is user-writable, it supports local review but is not tamper-proof evidence. References: src/…/audit.rs• L5-11, src/…/audit.rs• L25-49, src/…/audit.rs• L51-119

Execution contexts

The same command surface supports interactive setup, shell integration, scripts, agent tools, and CI jobs. Shared non-interactive behavior lets these contexts use cached or supplied credentials instead of terminal prompts.

Shell and automation use

The activate command generates shell code for supported shells. The generated hook calls the internal hook-env command, which resolves only shell-safe values and updates the session when its state changes. The global non-interactive option disables prompts and browser authentication for jobs that must provide credentials in advance. References: src/…/activate.rs• L4-79, src/…/hook_env.rs• L12-79, src/…/hook_env.rs• L231-355, src/…/mod.rs• L116-138

Agent access

The mcp command serves selected secret tools to an agent through the Model Context Protocol. The [mcp] configuration controls both the tools and the secrets they can reach. The optional request_secret tool can obtain a missing value through a local page, while the server stays non-interactive on its standard input and output so it does not corrupt the agent protocol. Under proxy run, fnox mcp relays to the proxy and the agent receives the controlled proxy view instead of direct secret values. References: src/…/mcp.rs• L10-20, src/…/mcp.rs• L29-49, src/…/mcp.rs• L80-108, src/…/mod.rs• L396-408

Credential proxy

The proxy command gives a child process controlled access to selected credentials through a local HTTPS proxy. proxy rules validates and displays the effective request rules without resolving secrets or minting leases. proxy run resolves the named secrets, lease inputs, and provider dependencies before it starts the child.

The child receives placeholders and proxy and certificate settings. Rules decide when a real secret or short-lived lease credential can reach a domain, method, and path. fnox removes configured secrets and common provider credential-chain variables from the child environment. Optional sandboxing makes the proxy the child’s only network route and hides fnox configuration and key material. The proxy also exposes the configured MCP tools to a child relay and cleans up leases when the run ends. The child command must honor the proxy and certificate settings for the proxy boundary to work; fnox preserves its exit status and handles interruption while it shuts down the proxy. References: src/…/proxy.rs• L104-111, src/…/proxy.rs• L126-167, src/…/proxy.rs• L197-215, src/…/proxy.rs• L305-356, src/…/proxy.rs• L363-494, src/…/proxy.rs• L522-620

Child-process execution

The exec command resolves the selected secrets and starts a child process with them in its environment. It can limit resolution with --only or --except, refresh selected cached values, expose file secrets through temporary paths, and add short-lived lease credentials. Optional redaction masks sensitive values in piped or redirected output, while interactive terminals remain unchanged. The child receives the command's exit result, and signal handling keeps interruption behavior aligned with normal process use. References: src/…/exec.rs• L11-29, src/…/exec.rs• L115-211, src/…/exec.rs• L224-365

Daemon and leases

The per-user daemon provides a background cache for secret resolution. The daemon command starts, stops, clears, and reports on that service, while --no-daemon disables it for one invocation. Status output can show cached-entry age and time-to-live metadata without values. Clearing the daemon evicts its in-memory cache; it does not change encrypted fnox sync data. The daemon can start again on the next read while it remains enabled.

The lease command manages short-lived credentials minted by configured backends. With no subcommand it creates leases for all configured backends; create can select a backend, duration, label, and output format, while list, revoke, and cleanup inspect and retire records in the per-project ledger. The default create output masks credential values, while json and env expose them for controlled automation. get can resolve a secret produced by a lease backend, and exec and proxy can create or reuse leases as part of their own runs. References: src/…/daemon.rs• L6-12, src/…/daemon.rs• L27-94, src/…/daemon.rs• L102-165, src/…/mod.rs• L116-118, src/…/lease.rs• L10-16, src/…/lease.rs• L31-107, src/…/lease.rs• L136-182, src/…/lease.rs• L184-264, src/…/lease.rs• L490-549, src/…/lease.rs• L564-647, src/…/lease.rs• L822-907

Change checklist

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

  • Keep the global option contract aligned with profile selection, write targeting, configuration discovery, and the commands that consume each option. A change in one can alter where a write command saves data.
  • Keep the top-level command tree, provider subcommands, generated help, usage output, and shell completion aligned. Completion must use the same config and profile context as the command it completes.
  • Keep the boundary between configuration-free commands and configuration-backed commands. Moving a command across it changes startup and error behavior.
  • Keep init, set, remove, import, and profile write targeting aligned. A command that reads an inherited or discovered secret must still save or remove the declaration in the file and profile that should own it.
  • Keep import parsing, filtering, prefixing, name validation, provider capability checks, confirmation, and metadata preservation aligned. Invalid names or unsupported providers must fail before a partial import.
  • Keep provider capability checks aligned with set, edit, import, sync, and re-encryption. A new provider path must not silently leave a protected value in plain text or permit changes to a read-only value.
  • Keep set remote key selection aligned with provider changes and inherited secrets. Switching providers must not reuse a key that belongs to the old provider.
  • Keep remove --file separate from content deletion. Removing a declaration must not be documented or implemented as revoking a remote value or deleting a stored file.
  • Keep file resolution, destination replacement, mode 0600, dry-run behavior, and resolve-before-write ordering aligned. A file write must not leave a partial set or follow an unsafe symlink.
  • Keep get, exec, and lease resolution aligned when a secret is produced by a lease backend. A cache or dependency change must not bypass lease prerequisites or return the wrong produced key.
  • Keep lease ledger addressing, backend revocation, expiry cleanup, credential masking, and output formats aligned. A shortened ID must not revoke the wrong record, and real credentials must not enter summary output.
  • Keep exec filtering, environment removal, file-secret cleanup, lease lifetime, output redaction, and child exit handling aligned. A change can resolve an unintended secret or leak a value through output.
  • Keep MCP allowlists, provider dependencies, request-secret behavior, non-interactive startup, and proxy relay flags aligned. An allowed secret whose provider dependency is hidden can fail at authentication time.
  • Keep proxy rule planning, dependency resolution, placeholder variables, ambient credential removal, sandbox setup, lease cleanup, and signal handling aligned. A child can otherwise bypass the intended credential boundary.
  • Keep CI vendor detection, sensitive-value filtering, multiline handling, and emitted mask syntax aligned. A supported CI job must not report success without masking the values it needs to protect.
  • Keep sync target capability checks, raw-value resolution, local-source markers, file cache handling, and stale-entry removal aligned. These rules decide both where encrypted values are written and which old cache entries are removed.
  • Keep push planning, target validation, dependency resolution, batching, confirmation, and partial-failure reporting aligned. A change can send a value to an unintended deployment store.
  • Keep shell activation, hook output, non-interactive behavior, and session cleanup aligned. A change can leave stale values in a shell or expose a value that is not allowed there.
  • Keep daemon cache controls, TTL reporting, explicit cache clearing, and the separation from encrypted sync data aligned. A cache command must not appear to remove a durable local copy.
  • Keep audit log reading independent from unrelated configuration errors. Operators must still be able to review access records when normal configuration loading fails.
  • Keep audit request fields, filters, escaped terminal output, and JSON-lines output aligned. A proxy request record must remain safe to display and useful for review.

Important failure modes

TriggerConsequenceGuard
A write runs with several active profiles and no clear targetThe command cannot safely choose which profile to changeSet --write-profile
set, remove, or import uses an explicit path or scope that differs from the intended config layerThe declaration is changed in a different file than the one used by later readsCheck --config, --global, --walk-up, and the selected write profile together
set updates an inherited secret without a local write targetThe local override can be saved in the wrong profile or fileSelect the intended profile and inspect the target path with config-files
set changes a secret to a different remote provider without --key-nameThe old provider's remote key is not reused, so the value can be stored under an unexpected nameSet the intended remote key explicitly when provider names change
import reads stdin without --force or --dry-runThe command cannot both consume stdin and ask for confirmationUse a file, --force, or --dry-run
import uses a remote-only providerNo encryption-backed import is possibleChoose an encryption-capable provider
A provider reference is absent from the active profilesResolution or validation reports a missing providerRun provider list, then check or doctor
edit changes a read-only provider valueThe edit is rejected instead of writing a value the provider cannot updateChange the value at its source or use a writable provider
remove --file is expected to delete file content or remote dataOnly the declaration is removed, leaving stored content in placeDelete or revoke the underlying content separately when required
files write resolves one file successfully and a later file failsNo selected file is written because resolution completes before writingFix the unresolved provider or file, then run files write again
A managed file path is a symlinkWriting through the link could update an unintended locationfiles write replaces the destination instead of following the link
sync selects a target without encryption capabilityNo protected local copy can be createdSelect an encryption-capable provider with -p or configure default_provider
check is expected to print a valueSecret values are never printed, so the output cannot be used as a read operationUse get for one value or list --values for an explicit value view
ci-redact runs outside CI or under an unsupported vendorNo runtime mask is emitted and the command fails with guidanceRun it in a supported CI environment and use the vendor's protected-variable feature when needed
A multiline secret is sent to GitHub Actions maskingParts of the value can remain visible in logsStore multiline values in a suitable secret manager or avoid relying on runtime masking
A proxy rule names an unknown secret or leaseThe proxy cannot build a safe request planValidate the [proxy] rules and provider-backed dependencies before running
Proxy sandbox support is unavailable or disabledThe command may fail before resolution or may run with a network path that code can bypassInstall the required sandbox tool and use --sandbox when isolation is required
A child process does not honor the proxy and CA settingsRequests can fail or the process can attempt an unintended credential pathUse a client with proxy and CA support, and use sandboxing for enforcement
A child inherits a provider credential-chain variableIt can reach a store outside the proxy rulesUse proxy run, which removes configured and ambient provider credential variables
MCP allowlist entries omit provider dependenciesThe agent can see an allowed secret but its provider may fail to authenticateAdd the provider dependency to mcp.secrets or allow the required provider path
A non-interactive command needs a prompt or browser loginThe job cannot complete authentication or inputSupply cached or environment credentials and use --non-interactive deliberately
A shell hook cannot load configuration or resolve allowed valuesThe shell receives no usable update and retries laterFix configuration or provider access
The daemon holds a stale value after a provider changeA read can return old dataUse --refresh or clear the affected daemon cache
daemon clear is expected to remove an encrypted sync copyThe in-memory cache is cleared but the durable sync data remainsTreat daemon cache and fnox sync data as separate stores
A lease backend is missing, its required secret fails, or its requested duration exceeds its limitLease creation fails before a usable credential is recordedConfigure the backend, resolve its required inputs, and use an allowed duration
A lease ID prefix matches more than one recorded IDRevocation is refused instead of selecting an ambiguous recordUse a longer prefix or the full ID from fnox lease list
A lease backend cannot revoke a credentialThe local ledger is marked revoked but the remote credential may remain until expiryKeep backend access available and treat ledger status as local bookkeeping
Audit logging is off or the log path is unreadableThe review shows no entries or returns a read errorEnable [audit] enabled = true or FNOX_AUDIT=on, then check the reported path

Key files

FileWhy to read it
src/main.rsShows the process entry point and early command setup.
src/…/mod.rsDefines global options, command routing, profile validation, configuration boundaries, and completion context.
src/…/init.rsShows project and global setup, non-interactive initialization, and the provider wizard.
src/…/set.rsShows the main secret write workflow, provider choice, remote key handling, inherited overrides, and write-target behavior.
src/…/import.rsShows supported input formats, import validation, encryption-only storage, and confirmation behavior.
src/…/remove.rsShows declaration removal and the separate file-entry removal path.
src/…/files.rsShows managed file lifecycle, safe destination writes, and file-backed secret storage.
src/…/get.rsShows how a named secret or lease-produced value becomes a user-visible value.
src/…/list.rsShows declaration views, source reporting, and opt-in value resolution.
src/…/check.rsShows value-free resolution checks, missing-value policy, and strict diagnostics.
src/…/edit.rsShows the interactive editing flow and read-only provider boundary.
src/…/exec.rsShows controlled secret delivery to a child process.
src/…/sync.rsDefines protected local copies, local-file behavior, file caching, and stale-cache cleanup.
src/…/mod.rsDefines provider management, supported provider choices, and provider subcommands.
src/…/add.rsShows provider creation, provider-specific creation options, templates, hardware setup, and configuration-scope selection.
src/…/discover.rsShows metadata-only item discovery, tag filtering, authentication retry, and output modes.
src/…/ci_redact.rsShows CI detection and vendor-specific masking limits.
src/…/push.rsDefines deployment planning, dependency resolution, batching, and publishing.
src/…/audit.rsDefines local access-log review, proxy request records, filters, and output modes.
src/…/activate.rsDefines shell-hook generation.
src/…/hook_env.rsDefines shell-session updates and cleanup.
src/…/mcp.rsDefines MCP tool serving, secret allowlists, and proxy relay behavior.
src/…/proxy.rsDefines credential brokering, placeholder environments, sandbox use, ambient credential removal, leases, and child-process cleanup.
src/…/lease.rsDefines lease creation, output safety, ledger inspection, revocation, and expiry cleanup.
src/…/daemon.rsDefines daemon lifecycle, cache inspection, and explicit eviction.