Secrets management
Piping encrypts connection passwords, private keys, sync tokens, OIDC client secrets and assistant API keys in PostgreSQL. The UI and API let you replace or clear values, but do not display them. The backend decrypts them when needed.
Storage model
A secret is split across four objects:
| Object | Purpose |
|---|---|
| Secret variable | The named handle: UUID, key, is_masked and is_protected flags |
| Value store | The encrypted value, one row per secret UUID |
| Scope binding | Attaches a secret to a scope (global, tenant_group, tenant, site, connection_target) with a numeric weight |
| Usage binding | The canonical link between a consumer field and a secret: consumer_type + consumer_id + field_key → secret UUID |
Usage bindings identify secret-backed fields. Consumer records (connection configs, credential sets and sync sources) store the secret UUID in place of its value.
Encryption at rest
Values are encrypted with AES-256-GCM and stored as a versioned envelope enc:v1:<base64(nonce + tag + ciphertext)> with a random 12-byte nonce per write. The backend refuses to read any stored value that is not in this canonical envelope format.
The cipher key is a base64-encoded 32-byte key, referenced in the backend configuration:
[secrets.cipher]
key_material_ref = "env:PIPING_SECRETS__CIPHER_KEY_B64"
key_material_ref accepts env:<ENV_VAR> (default, reads PIPING_SECRETS__CIPHER_KEY_B64) or inline:<BASE64>. See Configuration for how config files and PIPING_* environment variables are layered.
Tip: Treat the cipher key like a database backup dependency. If the key is lost, every stored secret value becomes unrecoverable — back up the key together with the database.
What consumes secrets
Each secret field is identified by a consumer type and a field key:
| Consumer type | Secret fields |
|---|---|
connection_scope:connection_target | Per-host secrets resolved at connect time |
connection_config:record | Credential leaves of shared connection-config records, e.g. credentials.password, credentials.private_key |
user_connection_credential_set | Personal credential sets: ssh_password, ssh_private_key, rdp_username, rdp_password, vnc_password |
user_auth_password | Local user login password (local_password) |
oidc_settings | OIDC client secret (Access control) |
sync_provider | Inventory sync source api_token and webhook_secret (Inventory sync) |
assistant_instance | LLM provider api_key (Assistant) |
proxy_node:credential | Per-node authentication secret for proxy nodes (node_secret) |
job_template:runtime_env | Environment variables a job delivers from secret references (Runtime context) |
playbook_project | Git read credential of a playbook project (scm_credential, Projects and repositories) |
Secrets in automation
A job receives a secret only through a declared secret reference: the environment name in options.secret_refs maps to a secret UUID, and the run gets the value as an environment variable. The value is never copied into the project, a parameter value, an extra-var or a run log. Job read and credential delegation are separate permissions, and protected secrets are refused at launch.
Deleting a secret that a job or project still references is blocked by the usage binding, so a saved job does not lose its credential silently. Replace or clear the reference first.
Write-only lifecycle
All secret edits go through one intent-based endpoint, PUT /api/v1/secret-fields:
| Intent | Effect |
|---|---|
set | Create the secret on first write, or replace its stored value |
rotate | Replace the value of an existing secret |
clear | Remove the usage binding — the field is no longer secret-backed |
Reading back (GET /api/v1/secret-fields?consumer_type=…&consumer_id=…) returns state only — whether the field is enabled and has_value — never the value. The UI follows the same rule: edit forms show a (unchanged) placeholder for stored passwords and keys, and leaving the field empty keeps the current value.
Personal credential set fields are additionally owner-fenced: only the owning user can list or modify them, regardless of role.
Shared accounts vs personal credential sets
Shared accounts live in connection-config records assigned to a scope (global → region → site → rack → device). A credential leaf in a record is either a literal value or a bare secret UUID reference. The reveal endpoint for a record echoes only the secret-reference fields, and populates their values only when the caller has secret visibility (see below).
Personal credential sets are per-protocol bundles managed under Account → Settings → Credentials. They are private to their owner and merge with shared defaults when a session is launched — see Connections for the launch-account picker.
How secrets reach sessions
At connect time the backend materializes the host configuration, builds the launch parameters, and replaces secret-UUID references with decrypted values entirely server-side. A reference only resolves if it passes the secret fence — the UUID must be:
- bound to the target host's
connection_targetscope, or - owned by the launching user's own credential set, or
- present in the host's materialized configuration, or
- bound to the exact connection-config record and field path that contributed it.
An arbitrary UUID pasted into a credential field does not resolve.
Per protocol:
- SSH — credentials never leave the backend. The backend negotiates SSH itself; the session client-credentials endpoint rejects SSH sessions outright.
- VNC / RDP — after the session is created, the browser fetches
GET /api/v1/connections/sessions/{id}/client-credentials, which is filtered to the minimum the protocol client needs:passwordfor VNC,usernameandpasswordfor RDP, for that session only. - Playbooks — SSH launch material for playbook runs is resolved in memory on the backend, fenced against the requesting user's secret visibility, and never persisted.
Visibility, masking, and audit
Reading decrypted secret values anywhere — record reveal, session credentials, MCP — requires the SECRET action on the secret_variable resource (Access control). Without it, resolution returns no values.
When secret variables are rendered into a host's materialized configuration, a variable flagged is_masked appears as ******** and one flagged is_protected resolves to null; real values are only produced on the connect path. If the same key is bound at several scopes, the higher weight wins, then the more specific scope: global < tenant_group < tenant < site < connection_target.
Every resolution emits a secrets.resolve event to the audit log listing the resolved secret keys — values are never written to the audit trail.
REST API reference
| Method | Path | Purpose |
|---|---|---|
GET | /api/v1/secret-fields | List secret field states for a consumer (no values) |
PUT | /api/v1/secret-fields | Apply a set / rotate / clear intent |
PUT | /api/v1/secrets/{id}/value | Set a secret value by UUID |
DELETE | /api/v1/secrets/{id}/value | Delete a stored secret value |
GET | /api/v1/connection-config/records/{id}/credentials | Reveal a record's secret-reference fields |
GET | /api/v1/connections/sessions/{id}/client-credentials | Session credentials (VNC/RDP only) |
The /api/v1/secrets/{id}/value endpoints require the SECRET action; the authoritative route list is in the API reference.