Repository navigation
fix: quote coverage exclusion pattern so it is never parsed as shell - #487
Merged
Merged
Conversation
Joeri-Abbo
requested review from
ergousha,
markvl-sbp and
sbp-bvanb
as code owners
October 10, 2026 14:24
ergousha
approved these changes
Oct 12, 2026
ergousha
left a comment
Contributor
There was a problem hiding this comment.
Tried shellQuote on task 3.54: the normal regex still filters the same packages and a value with quotes/; touch just gets printed, nothing runs. LGTM.
ergousha
force-pushed
the
heph/fix-f5643d75-f5
branch
from
October 20, 2026 09:13
8d0661a to
e883367
Compare
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.
Vulnerability
In
build/task.yml, thecoveragetask interpolated{{.CODE_COVERAGE_FILE_EXCLUSIONS}}directly into shell strings:grep -v '…'inside the-coverpkg=$(…)substitution, where a single quote in the value ends the argument.echo "CODE_COVERAGE_FILE_EXCLUSIONS: …", where"or$(…)in the value is expanded.The value comes from the
golang-unit-tests-exclusionsaction input. If a consumer wires untrusted text into that input, the coverage step, which holds the token, runs attacker-supplied shell. Severity is low because it needs a consumer to pass untrusted input.Fix
Both sinks now use Task's
shellQuotetemplate function, so the value is emitted as one safely escaped shell word and is never parsed as code:grep -v -e {{shellQuote .CODE_COVERAGE_FILE_EXCLUSIONS}}. The-estops a pattern starting with-from being read as an option.printf 'CODE_COVERAGE_FILE_EXCLUSIONS: %s\n' {{shellQuote …}}, replacing theechowith double quotes.Regex behaviour is unchanged for normal values.
shellQuoteexists in Task 3.54.0, whichaction.ymlpins (task-versiondefault).How to verify
task remote:coveragewithCODE_COVERAGE_FILE_EXCLUSIONSset to\(cmd\/app\|internal\/app\). The-coverpkglist should still omit those packages, and the echoed line should print the value unchanged.x' ; touch /tmp/pwned ; echo './tmp/pwnedshould not be created, and the value should print literally.task --dry remote:coverageif you want to see the quoting.Not verified by execution: this session had no shell, so the change was checked by reading only.