Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent script injection attack in GitHub Actions #3953

Merged
merged 1 commit into from
Dec 7, 2024

Conversation

mudge
Copy link
Contributor

@mudge mudge commented Dec 7, 2024

Information in the github context should be treated as untrusted user input and is therefore unsafe to interpolate into scripts. Instead, mitigate their damage by using an intermediate environment variable instead.

See GHSA-7x29-qqmq-v6qc and https://docs.github.com/en/actions/security-for-github-actions/security-guides/security-hardening-for-github-actions#understanding-the-risk-of-script-injections

Information in the github context should be treated as untrusted user
input and is therefore unsafe to interpolate into scripts. Instead,
mitigate their damage by using an intermediate environment variable
instead.

See GHSA-7x29-qqmq-v6qc and
https://docs.github.com/en/actions/security-for-github-actions/security-guides/security-hardening-for-github-actions#understanding-the-risk-of-script-injections
@mudge mudge merged commit 6537bc7 into develop Dec 7, 2024
1 check passed
@mudge mudge deleted the fix-github-context-interpolation branch December 7, 2024 13:10
Comment on lines 17 to +21
echo "Current ref: $GITHUB_REF"
echo "Base ref: $GITHUB_BASE_REF"
echo "Head ref: $GITHUB_HEAD_REF"
echo "Repository: $GITHUB_REPOSITORY"
echo "Head repository: ${{ github.event.pull_request.head.repo.full_name }}"
echo "Head repository: $REPO_FULL_NAME"
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like these echo commands were probably only used when we were initially debugging this workflow, so perhaps this entire "Log current branches and repositories" could / should also be deleted? 🤔

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