You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Check Env Files an Env File Includes When read_env_value Reads It #3912
read_env_value in lib/sh/secrets.sh sources the env file in a child bash, bash -Eeuo pipefail -c '... source "$1" ...'. Its contract says it checks nothing about the file, so a caller runs require_secret on it first. That covers the file named in $1. It does not cover a file that env file includes.
An env file can include a second one behind a guard, so that the second file is checked wherever the checker is loaded:
read_env_value's child bash is started fresh, and no require_secret is defined in it. So declare -F fails, the guard is skipped, and extra.env is sourced without its mode or line-ending check. That happens even where extra.env is world-writable or carries CRLF line endings. The caller cannot check it either, because only the child sees the include.
How a downstream repository closed it
ptr727/HomeAutomation-Config hit this with its docker.env, which includes mail.env (#890 phase 2a there). It added:
A loader:load_env_file <path> runs require_secret on the file, then sources it.
Helper text: a helper prints load_env_file and every function it calls as declare -f text.
The child:read_env_value's child bash evaluates that text before it reads. So the child runs load_env_file "$1", and the include's guard then finds require_secret defined.
That follows the shipping convention the downstream paths.sh already used for functions a child bash needs.
Done looks like
A file included behind declare -F require_secret is checked when it is read through read_env_value.
A test case proves it, by refusing an included file with a loose mode or CRLF line endings.
The comment on read_env_value says what the function checks, and what the caller still owes.
GOVERNANCE.md's host-secrets wording still matches the reader.
Found during a backlog burndown review in ptr727/HomeAutomation-Config, and filed on the maintainer's go-ahead.
Activity
ptr727 commentedon Nov 13, 2026
Backlog burndown claim (round 5, group 3, away mode): branch
burndown/env-include-check.Issue: #3912.
Predicted file set:
lib/sh/secrets.shtests/test_secrets_sh.pyGOVERNANCE.md, for the host-secrets reader wording only where the reader's contract changesspec/project-types.jsonis held by another branch and is not claimed here.Check Env Files an Env File Includes When read_env_value Reads It (#4164