Skip to content

fix: prevent command substitution in release tag validation#1

Merged
imnotStealthy merged 1 commit into
mainfrom
codex/fix-shell-command-injection-in-workflow-validation
May 8, 2026
Merged

fix: prevent command substitution in release tag validation#1
imnotStealthy merged 1 commit into
mainfrom
codex/fix-shell-command-injection-in-workflow-validation

Conversation

@imnotStealthy

Copy link
Copy Markdown
Owner

Motivation

  • Prevent command-substitution command-injection in the release workflow where ${{ inputs.tag }} was interpolated directly into a Bash run script, which could execute $(...) before the regex check in a job with contents: write and later GH_TOKEN use.

Description

  • Update the Validate release tag format step in .github/workflows/release-macos.yml to export the input via env: TAG: ${{ inputs.tag }} and validate with [[ "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]] instead of interpolating ${{ inputs.tag }} directly.

Testing

  • Verified by running npm run build (TypeScript compile) and npm test (vitest), and all tests passed. Inspect .github/workflows/release-macos.yml to confirm the env: TAG change and the new [[ "$TAG" =~ ... ]] check.

Codex Task

Copilot AI review requested due to automatic review settings May 8, 2026 19:21
@imnotStealthy imnotStealthy merged commit dc88206 into main May 8, 2026
3 checks passed
@imnotStealthy imnotStealthy deleted the codex/fix-shell-command-injection-in-workflow-validation branch May 8, 2026 19:23

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Hardens the macOS release workflow against command-substitution injection by avoiding direct interpolation of the workflow_dispatch tag input into a Bash script, ensuring the tag is validated safely before proceeding in a job that can write release contents.

Changes:

  • Pass ${{ inputs.tag }} into the validation step via env: TAG rather than embedding it directly in the Bash script.
  • Validate the tag using [[ "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]] to prevent command substitution from being evaluated.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

run: |
set -euo pipefail
[[ "${{ inputs.tag }}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]
[[ "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants