fix(security): add jq dependency and use it for safe JSON env injection#37
Open
onurege3467 wants to merge 1 commit into
Open
fix(security): add jq dependency and use it for safe JSON env injection#37onurege3467 wants to merge 1 commit into
onurege3467 wants to merge 1 commit into
Conversation
Replace the raw heredoc in docker-entrypoint.sh (which can produce malformed JSON if env vars contain quotes, newlines, or other special characters) with jq --arg, which properly JSON-encodes all values. Add jq as an explicit Dockerfile dependency so it is always available at runtime, eliminating the jq-not-found fallback path entirely. Closes Eyevinn#31
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.
Closes #31
Replace the raw heredoc in docker-entrypoint.sh (which can produce
malformed JSON if env vars contain quotes, newlines, or other special
characters) with jq --arg, which properly JSON-encodes all values.
Changes:
Dockerfile: Addjqas an explicit Alpine package dependency soit is always available at runtime
docker-entrypoint.sh: Usejq -n --argto generate the env-config.jsJSON safely, instead of a raw heredoc that interpolates variables directly
into JSON without escaping
Why this fix: The jq --arg command takes each value as a raw string
argument and handles JSON encoding internally — double quotes, backslashes,
newlines, null bytes, and all other special characters are properly escaped
in the output. The heredoc fallback (which lacked escaping for anything
beyond backslash, double-quote, and tab) is eliminated by ensuring jq is
always installed.
Verification:
bash -n docker-entrypoint.sh— shell syntax clean