Skip to content

fix(security): Prevent script injection in changelog-preview workflow#813

Merged
BYK merged 1 commit into
masterfrom
fix/DI-1918-script-injection-prevention
May 6, 2026
Merged

fix(security): Prevent script injection in changelog-preview workflow#813
BYK merged 1 commit into
masterfrom
fix/DI-1918-script-injection-prevention

Conversation

@fix-it-felix-sentry
Copy link
Copy Markdown
Contributor

Summary

This PR fixes a high-severity security finding by preventing potential script injection in the changelog-preview GitHub Actions workflow.

Changes

Moved github.event.pull_request.head.sha from direct interpolation in the shell script to an environment variable. This follows GitHub's security best practices for handling untrusted context data.

Before:

run: |
  HEAD_SHA="${{ github.event.pull_request.head.sha || github.sha }}"

After:

env:
  HEAD_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
run: |
  # HEAD_SHA is now safely available as an environment variable

Security Impact

Direct interpolation of GitHub context data in shell scripts can allow attackers to inject malicious code. By using an intermediate environment variable, the value is safely escaped and prevents script injection attacks.

References

Move github.event.pull_request.head.sha from direct interpolation to
environment variable to prevent potential script injection attacks.

Fixes: https://linear.app/getsentry/issue/VULN-1637
Fixes: https://linear.app/getsentry/issue/DI-1918

Co-Authored-By: fix-it-felix-sentry[bot] <260785270+fix-it-felix-sentry[bot]@users.noreply.github.com>
@linear-code
Copy link
Copy Markdown

linear-code Bot commented May 6, 2026

@BYK BYK merged commit 134b650 into master May 6, 2026
18 checks passed
@BYK BYK deleted the fix/DI-1918-script-injection-prevention branch May 6, 2026 11:27
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