-
Notifications
You must be signed in to change notification settings - Fork 0
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
Review GitHub Actions with zizmor 1.0.1 #687
Conversation
Here are the remaining findings:
The related explanations and suggested remediations are
I'll propose a fix based on those |
Just a comment on the following fix to highlight that, on one hand, it is an issue that is already mitigated upstream by the constraints on tag names, and on the other hand, it would still leaves room for other attacks in similar situations (without the contstraints), even though it removes the warning from the static analysis tool. env:
GITHUB_REF_NAME: ${{ github.ref_name }}
run: tar -C package -czf node-${{ matrix.node-version }}-fractal-web-${GITHUB_REF_NAME}.tar.gz build package.json node_modules LICENSE Already mitigated upstreamEven without addressing the warning reported by zizmor, injection is not possible in this specific case because the action is executed only when the following constraints on tags are met: tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+[a-c][0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+-[a-c][0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+alpha[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+beta[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+rc[0-9]+' Similar problematic case exploiting the issue titleGit tags already limit the characters that can be used (for example, spaces are not allowed), but a similar action based on the issue title ( In the following (unrealistic) example, the job creates an artifact based on the issue title. Zizmor does not detect any issues. name: Open Issue Workflow
on:
issues:
types: [opened]
jobs:
job:
runs-on: ubuntu-latest
steps:
- name: Create foo file
run: touch foo.tar.gz
- name: Create secret file
run: echo "secret" > secret.txt
- name: Test
env:
ISSUE_TITLE: ${{ github.event.issue.title }}
run: tar -czf test-${ISSUE_TITLE}.tar.gz foo.tar.gz
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
path: test-*.tar.gz The purpose of the job is to create a file named To eliminate the problem, the filename should be escaped with quotes: run: tar -czf "test-${ISSUE_TITLE}.tar.gz" foo.tar.gz Similarly, to be cautious, we should escape in our action as well: run: tar -C package -czf "node-${{ matrix.node-version }}-fractal-web-${GITHUB_REF_NAME}.tar.gz" build package.json node_modules LICENSE |
Thanks a lot for these clarifications! |
I am starting with a bunch of
persist-credentials: false
(note: in some cases it may actually be needed to persist credentials.. I'll revert changes in this PR when appropriate).Checklist before merging
CHANGELOG.md