-
Notifications
You must be signed in to change notification settings - Fork 184
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
Improve security of github action #1822
base: main
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
3 Skipped Deployments
|
9db1094
to
7c85082
Compare
⚡️🏠 Lighthouse reportLighthouse ran against https://catalyst-latest-kxu1a1ljt-bigcommerce-platform.vercel.app 🖥️ DesktopWe ran Lighthouse against the changes on a desktop and produced this report. Here's the summary:
📱 MobileWe ran Lighthouse against the changes on a mobile and produced this report. Here's the summary:
|
exit 1 | ||
fi | ||
echo "ref=${{ github.event.pull_request.head.ref }}" >> $GITHUB_OUTPUT | ||
|
||
- name: Use commit SHA for filename |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this removed intentionally?
id: validate | ||
run: | | ||
# Validate ref name against allowed pattern (alphanumeric, dash, underscore, and forward slash only) | ||
if ! [[ "${{ github.event.pull_request.head.ref }}" =~ ^[a-zA-Z0-9/_-]+$ ]]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this line i think we should still env the ${{ github.event.pull_request.head.ref }}
as if you enter something like "]]asdf"
it can escape the shell condition which can lead to RCE.
Using intermediate env vars like here: https://docs.github.com/en/actions/security-for-github-actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable should treat any special characters as escaped which we can safely use later
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we could use the default environment variable GITHUB_HEAD_REF
instead? Should probably have the same escaped value 🤔
What/Why?
https://docs.github.com/en/actions/security-for-github-actions/security-guides/security-hardening-for-github-actions#understanding-the-risk-of-script-injections
Testing
N/A