Repository navigation
Inline release-cut workflow inputs summary for security - #10041
AmethystLiang wants to merge 1 commit into
Conversation
Job runs with contents:write and secret scope. Avoid executing external actions here — even pinned to SHA, compromised commits can run arbitrary code. Pinning only blocks retagging, not commit tampering. Inline implementation uses jq to parse workflow_dispatch inputs as JSON data (never shell-interpolated) to prevent injection from dispatch values. Output remains a markdown table in the job summary for run auditability.
📝 WalkthroughWalkthroughThe release-cut workflow replaces the external workflow-input summary action with an inline shell step. The step serializes the full workflow inputs object to JSON, uses 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 Checkov (3.3.8).github/workflows/release-cut.ymlTraceback (most recent call last): Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 07f5da54-0cec-48b4-9d64-233e2b015e16
📒 Files selected for processing (1)
.github/workflows/release-cut.yml
| - name: Summarize workflow inputs | ||
| env: | ||
| INPUTS_JSON: ${{ toJSON(inputs) }} | ||
| run: | | ||
| { | ||
| echo "## Workflow inputs" | ||
| echo "" | ||
| echo "| Input | Value |" | ||
| echo "| --- | --- |" | ||
| jq -r '(. // {}) | to_entries[] | "| \(.key) | `\(.value)` |"' <<<"$INPUTS_JSON" | ||
| } >> "$GITHUB_STEP_SUMMARY" |
There was a problem hiding this comment.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== workflow excerpt =="
sed -n '1,140p' .github/workflows/release-cut.yml 2>/dev/null || true
echo
echo "== event/workflow inputs in repo =="
rg -n "on:|pull_request|workflow_dispatch|repository_dispatch|repository-dispatch|inputs:|release-cut|INPUTS_JSON|GITHUB_STEP_SUMMARY|jq" .github/workflows . -g '!node_modules' -g '!dist' -g '!build' || true
echo
echo "== behavioral probe: jq markdown rows from typical payloads =="
python3 - <<'PY'
import json, subprocess
rows = {
"newline_value": {"branch": "dev\n### injected header\n[1](/bad)"},
"pipe_value": {"msg": "a|b"},
"backtick_value": {"token": "`` secret `"},
"html_value": {"msg": "<img src=x onerror=alert(1)>"},
}
for name, value in rows.items():
out = subprocess.check_output(["jq", "-r", '(. // {}) | to_entries[] | "| \(.key) | `\\(.value)` |"', input=json.dumps(value).encode()).decode()
print(f"-- {name} --")
print(out.rstrip())
PYRepository: stablyai/orca
Length of output: 50370
🌐 Web query:
GitHub Actions secrets workflow_dispatch inputs markdown summary GITHUB_STEP_SUMMARY
💡 Result:
In GitHub Actions, you can display information from workflow_dispatch inputs in the workflow run summary by writing them to the GITHUB_STEP_SUMMARY environment file [1][2][3]. The GITHUB_STEP_SUMMARY environment variable contains the path to a unique file for each step in a job [1][4]. Anything you append to this file using Markdown will be rendered on the workflow run summary page [1][2][3]. To include workflow_dispatch inputs in your summary, reference them using the inputs context in your run step [5]. Example using shell script: - name: Summary with input run: | echo "### Workflow Summary" >> @actions/core toolkit, which provides a high-level API for managing summaries [6][7]: // Example using @actions/core const core = require('@actions/core'); const myInput = core.getInput('my_input_name'); await core.summary.addHeading('Input Summary').addText(The input provided was: ${myInput}).write; Key considerations: 1. Markdown Support: Job summaries support GitHub Flavored Markdown (GFM), including tables, headers, code blocks, and links [1][2][7]. 2. Persistence: The summary file is specific to each step [1][4]. All summaries generated by steps in a job are aggregated into a single job summary on the run page [1][2]. 3. Security: Since content is rendered through GitHub's HTML pipeline, you generally do not need to manually sanitize data, though standard practices apply [7].
Citations:
- 1: https://github.com/github/docs/blob/main/content/actions/reference/workflows-and-actions/workflow-commands.md
- 2: https://github.com/github/docs/blob/main/content/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions.md
- 3: https://oneuptime.com/blog/post/2026-01-30-github-actions-step-summary/view
- 4: https://github.com/github/docs/blob/main/content/actions/reference/workflows-and-actions/variables.md
- 5: https://github.com/github/docs/blob/main/content/actions/reference/workflows-and-actions/contexts.md
- 6: https://github.com/actions/toolkit/blob/main/packages/core/src/summary.ts
- 7: feat: @actions/core extensions for markdown summary actions/toolkit#1014
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== workflow release-cut first 140 lines =="
sed -n '1,140p' .github/workflows/release-cut.yml
echo
echo "== focused input/summary usages in workflow files =="
rg -n --glob '*.yml' --glob '*.yaml' 'release-cut|workflow_dispatch|inputs:|INPUTS_JSON|GITHUB_STEP_SUMMARY|jq -r' .github/workflows || true
echo
echo "== targeted jq behavior probe =="
python3 - <<'PY'
import json
import subprocess
cases = {
"newline_value": {"branch": "dev\n### injected header\n[1](/bad)"},
"pipe_value": {"msg": "a|b"},
"backtick_value": {"token": "`` secret `"},
"html_value": {"msg": "<img src=x onerror=alert(1)>"},
}
pattern = '(. // {}) | to_entries[] | "| \(.key) | `\\(.value)` |"'
for name, value in cases.items():
out = subprocess.check_output(
["jq", "-r", pattern],
input=json.dumps(value).encode(),
).decode()
print(f"-- {name} --")
print(out.rstrip())
for n, v in cases.items():
out = subprocess.check_output(["jq", "-r", '. // {}'], input=json.dumps(v).encode()).decode()
print(f"{n}-raw-json: {out.rstrip()}")
PYRepository: stablyai/orca
Length of output: 10479
Escape workflow input values before writing the summary.
The inputs are passed through jq safely, but the Markdown table still renders value content raw. Newlines from version_suffix, table/pipeline characters, backticks, or HTML-like content can alter or inject rows into the release audit summary; sanitize/escape keys and values before writing them.
|
Closing as already implemented on current main (a93e31a). The release-cut workflow now renders dispatch inputs with an inline bash/ I reviewed the complete one-file diff against the current workflow. Its full security and summary-output intent is covered, so there is no remaining change to land from this branch. |
Summary
Removes a third-party GitHub Action from the release-cut workflow and replaces it with an inlined bash script that safely parses and displays workflow dispatch inputs.
The release-cut job runs with
contents:writeandsecretsscope, making it a high-value target. The original implementation executed an external mutable action (@v1tag), which carries retagging and compromise risks. Even SHA-pinning only blocks retagging, not compromised commits. The new implementation avoids external execution entirely and uses safe JSON parsing.Implementation
Replaces
m-s-abeer/update-gha-summary-with-workflow-inputs@v1with an inlined script that:inputsas JSON via environment variable (never interpolated)jqto generate a markdown table$GITHUB_STEP_SUMMARYfor audit visibilityPrevents shell injection from dispatch-controlled values by keeping them as data throughout.
Screenshots
No visual change. Workflow job summary output format is unchanged.
Testing
pnpm lintpnpm typecheckpnpm testpnpm buildSecurity Audit
Threat: Executing mutable external actions in a high-privilege job (contents:write, secrets scope) creates supply-chain risk. Pinning to SHA only blocks retagging, not a compromised commit.
Fix: Eliminated external action execution. The replacement script uses environment-based JSON input (via
toJSON(inputs)) andjqfor safe parsing — dispatch values are never shell-interpolated, preventing injection attacks.Coverage: Input validation is data-driven (jq parses JSON), no command execution, no secret handling beyond pass-through display.
Notes
This change strengthens the security posture of the release workflow without changing its behavior. The inputs table is produced identically to before, but now entirely within the job context with no external dependencies.