-
Notifications
You must be signed in to change notification settings - Fork 125
fix(lcm): point stable latest at the promoted version digest #2088
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,17 +48,24 @@ jobs: | |
|
|
||
| - name: Promote images | ||
| run: | | ||
| set -euo pipefail | ||
| built_images='${{ inputs.images }}' | ||
| tag=${{ inputs.image_tag }} | ||
| for image in $(echo "$built_images" | jq -r '.[]'); do | ||
|
Comment on lines
+51
to
54
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: bash -c 'set -euo pipefail; for image in $(printf "%s" "{bad}" | jq -r ".[]"); do :; done; echo survived'Repository: gooddata/gooddata-ruby Length of output: 230 🏁 Script executed: #!/bin/bash
set -u
# Inspect the workflow around the reported lines and any relevant context.
if [ -f ".github/workflows/promote-to-stable.yaml" ]; then
echo "== file exists =="
wc -l ".github/workflows/promote-to-stable.yaml"
echo "== lines 1-90 =="
cat -n ".github/workflows/promote-to-stable.yaml" | sed -n '1,90p'
else
echo "file not found"
fi
echo "== bash pipe/subshell behavior probe =="
bash -c 'set -euo pipefail; for image in $(printf "%s" "{bad}" | jq -r ".[]"); do :; done; echo survived' || true
echo "== bash function-local set vs pipeline probe =="
bash -c 'set -euo pipefail
run() { for image in $(printf "%s" "{bad}" | jq -r ".[]"); do :; done; echo survived_after_function; }
run
echo survived_after_call' || true
echo "== bash -c exit probe =="
bash -c "set -euo pipefail; for image in \$(printf '%s' '{bad}' | jq -r '.[]'); do :; done; echo survived" || trueRepository: gooddata/gooddata-ruby Length of output: 4050 Capture the
🧰 Tools🪛 zizmor (1.28.0)[error] 52-52: code injection via template expansion (template-injection): may expand into attacker-controllable code (template-injection) [error] 53-53: code injection via template expansion (template-injection): may expand into attacker-controllable code (template-injection) 🤖 Prompt for AI Agents |
||
| crane cp \ | ||
| "${INFRA_REPO_URL}/staging/${image}:${tag}" \ | ||
| "${INFRA_REPO_URL}/stable/${image}:${tag}" | ||
| crane cp \ | ||
| "${INFRA_REPO_URL}/staging/${image}:latest" \ | ||
| "${INFRA_REPO_URL}/stable/${image}:latest" | ||
| # latest must be the digest just promoted, not whatever staging:latest is now | ||
| crane tag "${INFRA_REPO_URL}/stable/${image}:${tag}" latest | ||
|
|
||
| promoted=$(crane digest "${INFRA_REPO_URL}/stable/${image}:${tag}") | ||
| current=$(crane digest "${INFRA_REPO_URL}/stable/${image}:latest") | ||
| if [[ "${promoted}" != "${current}" ]]; then | ||
| echo "::error::stable/${image}:latest (${current}) != :${tag} (${promoted})" | ||
| exit 1 | ||
| fi | ||
|
Comment on lines
+61
to
+66
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win Verify the staging digest as well. The current check only compares Proposed fix+ staging=$(crane digest "${INFRA_REPO_URL}/staging/${image}:${tag}")
crane cp \
"${INFRA_REPO_URL}/staging/${image}:${tag}" \
"${INFRA_REPO_URL}/stable/${image}:${tag}"
...
- if [[ "${promoted}" != "${current}" ]]; then
+ if [[ "${staging}" != "${promoted}" || "${promoted}" != "${current}" ]]; then🤖 Prompt for AI Agents |
||
|
|
||
| echo "Promoted image ${image} to stable" | ||
| echo "Promoted image ${image} to stable as ${tag} + latest" | ||
| done | ||
|
|
||
| - name: Promote charts | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
rg -n -C 6 'workflow_dispatch|workflow_call|pull_request|inputs\.(images|image_tag)' .github/workflows/promote-to-stable.yamlRepository: gooddata/gooddata-ruby
Length of output: 989
🏁 Script executed:
Repository: gooddata/gooddata-ruby
Length of output: 3465
🌐 Web query:
GitHub Actions workflow_call inputs expression evaluation substituted into run string before execution💡 Result:
Yes, GitHub Actions expressions wrapped in
${{ }}syntax are evaluated and substituted into theruncommand string before the shell script is executed on the runner [1][2][3]. When you use the${{ }}syntax directly within arunstep, the GitHub Actions runner processes the expression, converts it into its string representation, and performs a literal text substitution into the command block [1][3]. This occurs before the runner generates and executes the temporary shell script [1][3]. Security Implications Because this substitution happens before the shell interprets the command, using${{ }}for inputs directly inside arunstring is a primary vector for shell command injection [1][2]. An attacker who controls the input value can inject characters (such as",;, or&) to break out of intended quotes or command structures, allowing them to execute arbitrary commands on the runner [1][3]. Recommended Best Practice To safely handle inputs inrunsteps, you should use environment variables instead of direct${{ }}substitution [2]. By mapping the input to an environment variable in theenvblock, the value is passed to the shell process safely as data rather than being interpreted as part of the command's raw text [2]. Example of the vulnerable approach: - name: Vulnerable step run: echo "${{ inputs.my-input }}" # Unsafe if input contains shell metacharacters Example of the recommended approach: - name: Secure step env: MY_INPUT: ${{ inputs.my-input }} run: echo "$MY_INPUT" # Safe, as the value is treated as a variable stringCitations:
Do not interpolate workflow inputs directly into shell source.
${{ inputs.image_tag }}is substituted into the runner script before Bash executes it, so a tag containing shell metacharacters can inject commands during image promotion. Map bothinputs.imagesandinputs.image_tagvia step-levelenv, quote the shell variables, and validateIMAGE_TAGbefore using it as a registry tag.🧰 Tools
🪛 zizmor (1.28.0)
[error] 52-52: code injection via template expansion (template-injection): may expand into attacker-controllable code
(template-injection)
[error] 53-53: code injection via template expansion (template-injection): may expand into attacker-controllable code
(template-injection)
🤖 Prompt for AI Agents
Source: Linters/SAST tools