Skip to content

Inline release-cut workflow inputs summary for security - #10041

Closed
AmethystLiang wants to merge 1 commit into
mainfrom
fix-p2-gha-release-cut-pin
Closed

AmethystLiang wants to merge 1 commit into
mainfrom
fix-p2-gha-release-cut-pin

Conversation

@AmethystLiang

Copy link
Copy Markdown
Contributor

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:write and secrets scope, making it a high-value target. The original implementation executed an external mutable action (@v1 tag), 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@v1 with an inlined script that:

  • Takes inputs as JSON via environment variable (never interpolated)
  • Parses safely with jq to generate a markdown table
  • Outputs to $GITHUB_STEP_SUMMARY for audit visibility
  • Handles all dispatch inputs automatically, including any added in the future

Prevents 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 lint
  • pnpm typecheck
  • pnpm test
  • pnpm build
  • Release-cut workflow runs and produces correct inputs table in job summary

Security 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)) and jq for 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.

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.
@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The 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 jq to generate a Markdown table of input keys and values, and appends the table to $GITHUB_STEP_SUMMARY. Inline comments were updated to describe the security and scoping approach.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: inlining the release-cut workflow inputs summary for security.
Description check ✅ Passed It is mostly complete and explains the change, screenshots, testing, security audit, and notes; the AI Review Report is missing.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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.yml

Traceback (most recent call last):
File "/usr/local/bin/checkov", line 2, in
from checkov.main import Checkov
ModuleNotFoundError: No module named 'checkov'


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 0326594 and f1f00e4.

📒 Files selected for processing (1)
  • .github/workflows/release-cut.yml

Comment on lines +80 to +90
- 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"

Copy link
Copy Markdown
Contributor

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:

#!/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())
PY

Repository: 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" >> $GITHUB_STEP_SUMMARY echo "The input provided was: ${{ inputs.my_input_name }}" >> $GITHUB_STEP_SUMMARY If you are using a JavaScript action, you can use the @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:


🏁 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()}")
PY

Repository: 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.

@OrcaWin

OrcaWin commented Oct 26, 2026

Copy link
Copy Markdown
Collaborator

Closing as already implemented on current main (a93e31a).

The release-cut workflow now renders dispatch inputs with an inline bash/jq step. It passes toJSON(inputs) through INPUTS_JSON, parses values as data, and appends the table to GITHUB_STEP_SUMMARY; the mutable m-s-abeer/update-gha-summary-with-workflow-inputs@v1 action is gone. The current version also limits the summary to workflow_dispatch and collapses input newlines.

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.

@OrcaWin OrcaWin closed this Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants