fix: pass SNAPSHOT as env var to prevent shell injection (RSPEED-3360) - #18
Closed
Lifto wants to merge 1 commit into
Closed
fix: pass SNAPSHOT as env var to prevent shell injection (RSPEED-3360)#18Lifto wants to merge 1 commit into
Lifto wants to merge 1 commit into
Conversation
Pass the Tekton SNAPSHOT parameter via step env instead of interpolating it directly into the script body. This prevents heredoc termination injection (CWE-78, CVSS 6.4) where a crafted SNAPSHOT value could escape the heredoc and execute arbitrary commands in the CI container. Before: $(params.SNAPSHOT) interpolated into bash heredoc After: $(params.SNAPSHOT) passed as env var, referenced as "$SNAPSHOT"
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository: rhel-lightspeed/coderabbit/.coderabbit.yaml Review profile: ASSERTIVE Plan: Enterprise Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Member
|
Duplicate of #14. |
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.
Summary
Fixes shell injection vulnerability in the
extract-server-imagetask (RSPEED-3360, CWE-78, CVSS 6.4).Problem
The
SNAPSHOTpipeline parameter was interpolated directly into a bash script via Tekton variable substitution inside a heredoc. Since Tekton performs$(params.*)replacement textually before the shell runs, an attacker who can influence theSNAPSHOTvalue could inject a literal newline followed byEOFto terminate the heredoc early and append arbitrary shell commands.Fix
Pass
SNAPSHOTviasteps[].env[].value: $(params.SNAPSHOT)and reference it as"$SNAPSHOT"inside the script, following Tekton security guidance on variable substitution.Before:
After:
Testing
This pipeline has no local test harness — it runs on Tekton in the CI cluster. The fix is a mechanical substitution (heredoc interpolation → env var), and the pipeline behavior is unchanged:
SNAPSHOTJSON is still parsed byjqto extract the container image URL.Post-merge validation: We will monitor the next CI run that triggers this pipeline and revert if the change causes failures.
Jira: RSPEED-3360