Read secrets from files (*_FILE) #114

Merged
jcoffey-dev merged 1 commits from feat/secret-files into main 2026-11-19 00:39:53 +00:00
Owner

K-W4 (#106). The webmail can read its secrets from mounted files, so they stay out of its environment.

  • APP_SECRET_FILE, APP_SECRET_PREVIOUS_FILE and OAUTH_CLIENT_SECRET_FILE read the value from a file. One trailing newline is dropped.
  • The webmail won't start if both forms are set, or if the file can't be read or is empty. The error names the variable and the path, never the value.
  • README: a section on secrets in files, and one on running with a read-only root: what the webmail writes (only SESSION_FILE), why /tmp is still worth giving it, and IMMUTABLE=1.

The server takes INBUXA_<NAME>_FILE the same way (inbuxa-server#461).

Tested

  • 4 new unit tests, and typecheck, the full test suite (312) and the build all pass.
  • On kind with the chart change (inbuxa-charts, K-W4): two replicas read both secrets from files and run with IMMUTABLE=1 on a read-only root. Sign-in across replicas and the token exchange pass, which needs the right client secret. The pod's environment has only the paths.
  • Before the chart gave the pod an fsGroup, the webmail refused to start with APP_SECRET_FILE: can't read /etc/inbuxa-webmail/app-secret (EACCES), and the old pods kept serving.

Should ship in 27.1-rc.7, with #113.

K-W4 (#106). The webmail can read its secrets from mounted files, so they stay out of its environment. - `APP_SECRET_FILE`, `APP_SECRET_PREVIOUS_FILE` and `OAUTH_CLIENT_SECRET_FILE` read the value from a file. One trailing newline is dropped. - The webmail won't start if both forms are set, or if the file can't be read or is empty. The error names the variable and the path, never the value. - README: a section on secrets in files, and one on running with a read-only root: what the webmail writes (only `SESSION_FILE`), why `/tmp` is still worth giving it, and `IMMUTABLE=1`. The server takes `INBUXA_<NAME>_FILE` the same way (inbuxa-server#461). **Tested** - 4 new unit tests, and typecheck, the full test suite (312) and the build all pass. - On kind with the chart change (inbuxa-charts, K-W4): two replicas read both secrets from files and run with `IMMUTABLE=1` on a read-only root. Sign-in across replicas and the token exchange pass, which needs the right client secret. The pod's environment has only the paths. - Before the chart gave the pod an `fsGroup`, the webmail refused to start with `APP_SECRET_FILE: can't read /etc/inbuxa-webmail/app-secret (EACCES)`, and the old pods kept serving. Should ship in 27.1-rc.7, with #113.
jcoffey-dev added 1 commit 2026-11-19 00:06:57 +00:00
Read APP_SECRET and OAUTH_CLIENT_SECRET from files
ci / node (pull_request) Skipped
ci / version (pull_request) Skipped
github/ci (branch) GitHub Actions
ci / github (pull_request) Successful in 1m45s
ci / docker-build (pull_request) Skipped
ci / publish (pull_request) Skipped
ci / announce (pull_request) Skipped
5e9605ac54
APP_SECRET_FILE, APP_SECRET_PREVIOUS_FILE and OAUTH_CLIENT_SECRET_FILE
read the secret from a mounted file, with one trailing newline dropped.
Both forms set, or a file that can't be read or is empty, stops the start
with an error naming the variable and path, never the value.

README: the read-only root filesystem, and what the webmail writes.
jcoffey-dev merged commit e77592c1e3 into main 2026-11-19 00:39:53 +00:00
jcoffey-dev deleted branch feat/secret-files 2026-11-19 00:39:53 +00:00
Sign in to join this conversation.