Why: a secret in the environment is visible to anything that can read the process's environment or the pod spec. Kubernetes and Docker mount secrets as files. The chart currently has to pass the webmail's OAuth client secret as an env var, with a lint exception marked TODO(K-S2).
What:
Two new variables:INBUXA_RECOVERY_ADMIN_FILE and INBUXA_WEBMAIL_CLIENT_SECRET_FILE name a file that holds the secret, as an alternative to INBUXA_RECOVERY_ADMIN and INBUXA_WEBMAIL_CLIENT_SECRET. These are every secret the server takes from its environment. API_TOKEN_ADMIN exists only in dev_mode builds and is left alone.
The relay:INBUXA_RELAY_JOIN_TOKEN_FILE works the same way.
Rules:
The file's trailing newline is dropped.
Setting both forms is refused, as is a file that can't be read or is empty.
Boot checks every one before anything else, so a bad one stops the start with the variable and path named, never the secret.
The legacy STALWART_*_FILE names are refused like every other STALWART_* name.
In the code:types::branding::secret_env_var and SECRET_ENV_VARS.
Config.json store credentials could already reference a file ({"@type": "File", "filePath": ...}), which covers the issue's second half.
Tested
Unit tests: value, file, trailing newlines, both set, empty, unreadable, and a real file on disk; plus the relay's token.
The debug binary:
a missing file, both set, and an empty file each exit 1 with the message;
a good WEBMAIL_CLIENT_SECRET_FILE runs;
in recovery mode with INBUXA_RECOVERY_ADMIN_FILE, the admin from the file gets 200 on /jmap/session and a wrong password gets 401;
the secret is not in the log.
fmt; cargo build -p inbuxa.
Docs: SPEC.md and the relay spec are updated here. The docs page (install/server.md, "The server's environment") gets its section in an inbuxa.org PR, held until the release that ships this.
Closes #425 (K-S2, tracker inbuxa/inbuxa-charts#14).
**Why:** a secret in the environment is visible to anything that can read the process's environment or the pod spec. Kubernetes and Docker mount secrets as files. The chart currently has to pass the webmail's OAuth client secret as an env var, with a lint exception marked TODO(K-S2).
**What:**
- **Two new variables:** `INBUXA_RECOVERY_ADMIN_FILE` and `INBUXA_WEBMAIL_CLIENT_SECRET_FILE` name a file that holds the secret, as an alternative to `INBUXA_RECOVERY_ADMIN` and `INBUXA_WEBMAIL_CLIENT_SECRET`. These are every secret the server takes from its environment. `API_TOKEN_ADMIN` exists only in `dev_mode` builds and is left alone.
- **The relay:** `INBUXA_RELAY_JOIN_TOKEN_FILE` works the same way.
- **Rules:**
- The file's trailing newline is dropped.
- Setting both forms is refused, as is a file that can't be read or is empty.
- Boot checks every one before anything else, so a bad one stops the start with the variable and path named, never the secret.
- The legacy `STALWART_*_FILE` names are refused like every other `STALWART_*` name.
- **In the code:** `types::branding::secret_env_var` and `SECRET_ENV_VARS`.
- **Config.json** store credentials could already reference a file (`{"@type": "File", "filePath": ...}`), which covers the issue's second half.
**Tested**
- Unit tests: value, file, trailing newlines, both set, empty, unreadable, and a real file on disk; plus the relay's token.
- The debug binary:
- a missing file, both set, and an empty file each exit 1 with the message;
- a good `WEBMAIL_CLIENT_SECRET_FILE` runs;
- in recovery mode with `INBUXA_RECOVERY_ADMIN_FILE`, the admin from the file gets 200 on `/jmap/session` and a wrong password gets 401;
- the secret is not in the log.
- fmt; `cargo build -p inbuxa`.
**Docs:** SPEC.md and the relay spec are updated here. The docs page (install/server.md, "The server's environment") gets its section in an inbuxa.org PR, held until the release that ships this.
jcoffey-dev
added this to the 27.1 milestone 2026-11-18 22:09:39 +00:00
INBUXA_RECOVERY_ADMIN and INBUXA_WEBMAIL_CLIENT_SECRET can come instead
from a file that INBUXA_RECOVERY_ADMIN_FILE or
INBUXA_WEBMAIL_CLIENT_SECRET_FILE names, such as a mounted Kubernetes or
Docker secret, so a secret never has to sit in the environment, where
anything that can read the process's environment or the pod spec sees
it. The relay's INBUXA_RELAY_JOIN_TOKEN takes _FILE the same way.
The file's trailing newline is dropped. Both forms set, or a file that
can't be read or is empty, stops the server as it starts (boot checks
every one), naming the variable and the path, never the secret.
The rule lives in types::branding::secret_env_var, its core a pure
function the unit tests drive; SECRET_ENV_VARS lists the variables it
covers.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Closes #425 (K-S2, tracker inbuxa/inbuxa-charts#14).
Why: a secret in the environment is visible to anything that can read the process's environment or the pod spec. Kubernetes and Docker mount secrets as files. The chart currently has to pass the webmail's OAuth client secret as an env var, with a lint exception marked TODO(K-S2).
What:
INBUXA_RECOVERY_ADMIN_FILEandINBUXA_WEBMAIL_CLIENT_SECRET_FILEname a file that holds the secret, as an alternative toINBUXA_RECOVERY_ADMINandINBUXA_WEBMAIL_CLIENT_SECRET. These are every secret the server takes from its environment.API_TOKEN_ADMINexists only indev_modebuilds and is left alone.INBUXA_RELAY_JOIN_TOKEN_FILEworks the same way.STALWART_*_FILEnames are refused like every otherSTALWART_*name.types::branding::secret_env_varandSECRET_ENV_VARS.{"@type": "File", "filePath": ...}), which covers the issue's second half.Tested
WEBMAIL_CLIENT_SECRET_FILEruns;INBUXA_RECOVERY_ADMIN_FILE, the admin from the file gets 200 on/jmap/sessionand a wrong password gets 401;cargo build -p inbuxa.Docs: SPEC.md and the relay spec are updated here. The docs page (install/server.md, "The server's environment") gets its section in an inbuxa.org PR, held until the release that ships this.