Commit 3fe2c45
committed
scripts: localize all 9 ADMIN_* in build_admin_flags
Two gemini medium findings on PR #678 caught that the
defense-in-depth localization I added was incomplete:
ADMIN_SESSION_SIGNING_KEY_FILE et al got `${VAR:-}` defaults into
locals at the top of the helper, but ADMIN_ENABLED and the two
ADMIN_ALLOW_* booleans were still accessed directly from the
calling environment further down in the function.
The gap defeated the comment's own claim. If a future refactor
ever drops one of those three booleans from the env forwarding,
`set -u` would crash on `${ADMIN_ENABLED}` (and the code path
below would silently fall through to defaults for the two
ALLOW_* flags, masking the misconfiguration). The point of the
local-with-default pattern is that every ADMIN_* reference goes
through one place where the safety net is guaranteed.
Localized all nine into `enabled`, `signing_key`, `full_keys`,
`read_only_keys`, `previous_key`, `admin_listen`, `tls_cert`,
`tls_key`, `allow_plaintext`, `insecure_cookie`. The two
ALLOW_* check sites at the bottom now read the locals instead of
re-fetching the globals — same value, but consistent with the
rest of the helper and the comment's contract.
No behaviour change for any valid input. Smoke-tested both
boolean validators (`ADMIN_ENABLED=invalid` and
`ADMIN_ALLOW_PLAINTEXT_NON_LOOPBACK=yes`) — local script-level
errors still fire with the targeted message before reaching
update_one_node.1 parent 14ec553 commit 3fe2c45
1 file changed
Lines changed: 10 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
872 | 872 | | |
873 | 873 | | |
874 | 874 | | |
875 | | - | |
876 | | - | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
877 | 881 | | |
878 | 882 | | |
879 | 883 | | |
| |||
884 | 888 | | |
885 | 889 | | |
886 | 890 | | |
| 891 | + | |
| 892 | + | |
887 | 893 | | |
888 | 894 | | |
889 | 895 | | |
| |||
944 | 950 | | |
945 | 951 | | |
946 | 952 | | |
947 | | - | |
| 953 | + | |
948 | 954 | | |
949 | 955 | | |
950 | | - | |
| 956 | + | |
951 | 957 | | |
952 | 958 | | |
953 | 959 | | |
| |||
0 commit comments