Connection Secrets
Ciaren never stores your database password.
A connection stores a secret reference, not the value. The reference says where the secret lives. All three sources are local, and none needs an external service.
| Reference | Source | Use it for |
|---|---|---|
PG_PASSWORD or env:PG_PASSWORD | Environment variable | .env-style setups. The simplest option |
keyring:pg-main | OS keychain (Windows Credential Manager, macOS Keychain, Secret Service on Linux) | Recommended on a desktop. Encrypted at rest and not inherited by child processes |
file:/run/secrets/pg_password | Secret file | Docker and Kubernetes secrets, which mount as files |
Whatever the source, Ciaren reads the value only when the connection is used. The value is:
- never written to the database,
- never returned by the API,
- never embedded in exported Python. Generated code reads the same reference at
run time (
os.environ[...],keyring.get_password(...), or the secret file) and passes it tosqlalchemy.URL.create, as the live connector does.
Environment variable
Set the variable before you start Ciaren, then use its name as the secret:
export PG_PASSWORD="super-secret"
ciaren serveTwo rules decide which variables a reference may name:
- Ciaren's own configuration variables (
CIAREN_API_TOKEN,CIAREN_WEBHOOK_SECRET, and the rest) are always refused. Otherwise a connection could send their values to a host its author chooses. - On a shared deployment, set
CIAREN_SECRET_ENV_ALLOWLISTto exact names or prefixes ending in*, for example["CIAREN_SECRET_*", "PG_PASSWORD"]. Connections can then use only the variables you designated. An empty list allows any variable, which is fine for a single user who owns the environment.
OS keychain
The keychain is built into the base install. Store a secret from the CLI. Ciaren prompts for the value and does not echo it:
ciaren secret set pg-mainThen enter keyring:pg-main as the connection's secret. ciaren secret unset pg-main removes it.
You can also stay in the editor. The connection form has a Store a value in the
OS keychain button under the secret field. Enter a name and the value and click
save. Ciaren writes the value to the keychain and fills the field with the
keyring:NAME reference. The value is sent once and is never stored, echoed
back, or logged. On a host with no keychain, such as a headless server or a
container, the button is disabled and a hover explains why. Use env: or
file: there.

Secret file
A file: reference may read only from the allowed secrets folders:
<DATA_DIR>/secrets and /run/secrets by default, or the list in
CIAREN_SECRET_FILE_DIRS. A connection therefore cannot point at an arbitrary
server file. Ciaren strips the trailing newline that Docker secrets carry.
On a hardened shared install, keep CIAREN_SECRET_FILE_DIRS and
CIAREN_STORAGE_ALLOWED_ROOTS in separate locations, so no storage
connection can write into a folder that secrets are read from.
Other safeguards
- Ciaren builds the SQLAlchemy URL from structured fields with
URL.create, both when it connects and in exported Python. A host, username, or database name with quotes or code-shaped characters stays an inert string. - Driver options cannot override a connection's host or port, so the SSRF guard
cannot be bypassed through
options. Table and schema identifiers are validated. - Ciaren scrubs the secret, including its percent-encoded form, from driver error
messages. A key containing
+ / = &or spaces cannot be read back out of a URL embedded in an error. - REST API connections refuse the well-known
credential headers (
Authorization,Cookie,X-API-Key) as custom headers. They also refuse credential-looking query parameter names (api_key,token,client_secret) in the default parameters and in an endpoint's own query string. This check is best effort: a credential under an unusual header or parameter name would be stored in plain text, so keep secrets in the authentication settings.
See also
- Connections: create and test a connection
ciaren secret: the CLI commands- Security model