Skip to content

fix(ci/security): workflow injection + unpinned action (quality-gate + latency-budget) - #186

Merged
KooshaPari merged 1 commit into
mainfrom
fix/workflow-security-injection
Jul 2, 2026
Merged

KooshaPari merged 1 commit into
mainfrom
fix/workflow-security-injection

Conversation

@KooshaPari

Copy link
Copy Markdown
Owner

Security fixes — 2 findings

Finding 1: Script injection via workflow_call inputs (quality-gate.yml)

File: .github/workflows/reusable/quality-gate.yml
Risk: ${{ inputs.not-applicable }}, ${{ inputs.coverage-report }}, ${{ inputs.coverage-format }}, ${{ inputs.threshold }} were interpolated directly into run: blocks. A caller passing a crafted input value could inject arbitrary shell commands.

Fix: Bind each input to a step-level env: var and reference via $VARNAME in shell. This is the canonical safe pattern (GitHub security guidance: https://github.blog/security/vulnerability-research/how-to-catch-github-actions-workflow-injections-before-attackers-do/).

Finding 2: Unpinned third-party action with write scope (latency-budget.yml)

File: .github/workflows/latency-budget.yml
Risk: actions/github-script@v7 (tag reference) used 2× on a workflow with pull-requests: write. Tag mutation by the action owner would execute arbitrary code with write permission on PR comments.

Fix: Pin both instances to full commit SHA f28e40c7f34bde8b3046d885e986cb6290c5673b (v7 tag as of 2026-07-02).

Verification

  • Both files pass YAML lint (no syntax changes beyond the security fixes)
  • All ${{ env.* }} interpolations in run: blocks are safe (env context is not attacker-controlled)
  • Summary/report echo steps use ${{ steps.*.outputs.* }} from internal step outputs — safe

quality-gate.yml: bind workflow_call inputs to env vars before shell
use to prevent script injection via inputs.not-applicable,
inputs.coverage-report, inputs.coverage-format, inputs.threshold.
Pattern: env: VARNAME: ${{ inputs.x }} then $VARNAME in run:.

latency-budget.yml: pin actions/github-script to full commit SHA
(f28e40c7f34bde8b3046d885e986cb6290c5673b, v7) — was unpinned @v7
tag on a workflow with pull-requests:write scope, allowing tag
mutation to execute arbitrary code with write permissions.
@gemini-code-assist

Copy link
Copy Markdown

Note

Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported.

@KooshaPari
KooshaPari merged commit 8bd3be5 into main Jul 2, 2026
11 of 21 checks passed
@KooshaPari
KooshaPari deleted the fix/workflow-security-injection branch July 2, 2026 07:36
@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@KooshaPari, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 27 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ca4f6d36-fa7f-4fa3-ae86-213542d1ebdf

📥 Commits

Reviewing files that changed from the base of the PR and between b6dc43d and 177ef37.

📒 Files selected for processing (2)
  • .github/workflows/latency-budget.yml
  • .github/workflows/reusable/quality-gate.yml

Note

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

⚠️ Parsing warnings (1)
Validation error: Unrecognized key: "review"
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/workflow-security-injection

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.

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

L17 Latency Budget Report

--- Latency Budget Summary ---
  Total endpoints checked: 0
  Passed: 0
  Warnings: 0
  Failures: 0

Checked against: budgets/rest-endpoints.yaml.

@sonarqubecloud

sonarqubecloud Bot commented Jul 2, 2026

Copy link
Copy Markdown

@kilo-code-bot

kilo-code-bot Bot commented Jul 3, 2026 •

Copy link
Copy Markdown

Code Review Summary

Status: Approved | Recommendation: Merge

Overview

No issues found in the changed code.

Files Reviewed (2 files)
  • .github/workflows/latency-budget.yml — pin actions/github-script to full SHA (supply-chain security)
  • .github/workflows/reusable/quality-gate.yml — bind workflow_call inputs to step env: vars (script injection remediation)

Both changes correctly address the documented security findings:

  1. Finding 1 (quality-gate.yml): All four inputs (not-applicable, coverage-report, coverage-format, threshold) are now passed via step-level env: and referenced as $VARNAME in run: blocks — the canonical GitHub-recommended pattern. if: conditions correctly use internal steps.*.outputs.* (not raw inputs).
  2. Finding 2 (latency-budget.yml): Both actions/github-script usages are pinned to full commit SHA f28e40c7f34bde8b3046d885e986cb6290c5673b. The # v7 comment safely identifies the tag version without resurfacing the un-pinned reference.

No pre-existing regressions detected in the changed lines. actions/checkout in quality-gate.yml was already SHA-pinned in the base; the new # v4.2.2 comment is documentation only and introduces no vulnerability.


Reviewed by step-3.7-flash-20260528 · Input: 112.9K · Output: 4.2K · Cached: 480.3K

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.

1 participant