fix(launcher/entrypoint): env carry array + widen verbose redaction - #1499
Open
Moon-Knight13 wants to merge 2 commits into
Open
fix(launcher/entrypoint): env carry array + widen verbose redaction#1499Moon-Knight13 wants to merge 2 commits into
Moon-Knight13 wants to merge 2 commits into
Conversation
The carry list was expanded unquoted into 'env -i', so any passlisted
variable whose value contains a space breaks the exec command line.
Example: NODE_OPTIONS="--max-old-space-size=4096 --enable-source-maps"
splits into 'NODE_OPTIONS=--max-old-space-size=4096' plus a stray
'--enable-source-maps', which env treats as the program to run — exec
fails and the container crash-loops through backoff instead of starting
Foundry.
Build the carry set as a bash array instead; each NAME=VALUE reaches
env as one argument. The ${arr[@]+...} expansion guards the
empty-array case under 'set -o nounset' on bash <4.4.
Repro:
NODE_OPTIONS='--a --b' bash -c '<old carry loop>; env -i $LIST env'
-> env: '--b': No such file or directory
The redaction regex '(.*PASSWORD|KEY.*)=.*' misses variables where the sensitive token is not adjacent to '=': FOUNDRY_PASSWORD_SALT, and any *_SECRET/*_TOKEN names, are printed in clear in the CONTAINER_VERBOSE environment dump. Match the sensitive keyword anywhere in the variable name instead, and add SECRET/TOKEN/SALT to the list.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two small, independent fixes in the container launch path.
1.
launcher.sh— carry env vars as an array (correctness)The carry list is expanded unquoted into
env -i, so any passlisted variable whose value contains a space breaks the exec command line:splits into
NODE_OPTIONS=--max-old-space-size=4096plus a stray--enable-source-maps, whichenvtreats as the program to run — exec fails and the container crash-loops through backoff instead of starting Foundry.Build the carry set as a bash array so each
NAME=VALUEreachesenvas one argument. The${arr[@]+...}expansion guards the empty-array case underset -o nounseton bash < 4.4.Repro:
2.
entrypoint.sh— widen verbose env-dump redaction (security)The redaction regex
(.*PASSWORD|KEY.*)=.*misses variables where the sensitive token is not adjacent to=:FOUNDRY_PASSWORD_SALT, and any*_SECRET/*_TOKENnames, are printed in clear in theCONTAINER_VERBOSEenvironment dump. Match the sensitive keyword anywhere in the variable name and addSECRET/TOKEN/SALT.Both changes are limited to
src/launcher.shandsrc/entrypoint.sh; no behavior change outside the described cases.