Skip to content

Harden CI workflows: prevent script injection, pin action to SHA#1

Open
murdercode wants to merge 1 commit into
mderouet:masterfrom
murdercode:harden-workflows
Open

Harden CI workflows: prevent script injection, pin action to SHA#1
murdercode wants to merge 1 commit into
mderouet:masterfrom
murdercode:harden-workflows

Conversation

@murdercode

@murdercode murdercode commented May 26, 2026

Copy link
Copy Markdown

What

Two small CI workflow hardening changes. No functional changes.

build.yml — script injection hardening

workflow_dispatch inputs and step outputs were interpolated directly as ${{ ... }} inside run: blocks. A value containing shell metacharacters could break out of the string and execute commands in the runner. They now all pass through env: and are referenced as quoted shell variables ("$VER"), which the runner treats as data rather than code.

Note: only triggerable by someone who already has write access to the repo (the workflow_dispatch input), so this is defensive hardening, not an externally exploitable vulnerability.

keepalive.yml — pin action to SHA

liskin/gh-workflow-keepalive@v1 (mutable tag) → pinned to the full commit SHA f72ff1a1336129f29bf0166c0fd0ca6cf1bcb38c (v1.2.1). Prevents a re-pointed tag from introducing unreviewed code.

Verification

  • Both files validate as YAML.
  • No remaining ${{ }} interpolation inside run: blocks.

- build.yml: pass workflow_dispatch input and step outputs through
  `env:` instead of interpolating `${{ ... }}` directly into `run`
  blocks, so user-supplied values can't break out of the shell string.
- keepalive.yml: pin liskin/gh-workflow-keepalive to a full commit SHA
  (v1.2.1) instead of the mutable `v1` tag.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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