-
Notifications
You must be signed in to change notification settings - Fork 346
Add github actions static analysis #1211
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
Conversation
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.
Pull Request Overview
Adds Zizmor static analysis to the CI pipeline by installing the tool, wiring it into tox, and defining GitHub Actions pinning policies.
- Integrate
zizmor
intotox.ini
for workflow scans - Pin
zizmor==1.9.0
inpyproject.toml
alongside existing linters - Introduce a Zizmor rules file to enforce action ref-pinning
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
tox.ini | Added zizmor command with --persona=regular flag |
pyproject.toml | Added zizmor==1.9.0 to the linting dependencies |
.github/zizmor.yml | Defined unpinned-uses policy for GitHub Actions pins |
Comments suppressed due to low confidence (1)
.github/zizmor.yml:1
- Zizmor looks for its config in
.zizmor.yml
at the repo root by default. Either move this file to the root or pass--config .github/zizmor.yml
when invokingzizmor
so the rules are actually applied.
rules:
@@ -48,6 +48,7 @@ commands = | |||
ruff check --diff {posargs:pytest_django pytest_django_test tests} | |||
ruff format --quiet --diff {posargs:pytest_django pytest_django_test tests} | |||
mypy {posargs:pytest_django pytest_django_test tests} | |||
zizmor --persona=regular .github/workflows/deploy.yml .github/workflows/main.yml |
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.
The PR description notes switching --persona=regular
to --persona=pedantic
, but the command still uses regular
. Update the flag to --persona=pedantic
to apply the stricter analysis.
zizmor --persona=regular .github/workflows/deploy.yml .github/workflows/main.yml | |
zizmor --persona=pedantic .github/workflows/deploy.yml .github/workflows/main.yml |
Copilot uses AI. Check for mistakes.
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.
LOL close. I'll do this in another PR to keep the changes to a minimum
@kingbuzzman you could also stick this into GHA (additionally) to have Zizmor report its findings through into the GH Security Analysis UI and they'd show up in PRs too. ---
name: GitHub Actions Security Analysis with zizmor 🌈
on: # yamllint disable-line rule:truthy
push:
pull_request:
jobs:
zizmor:
name: 🌈 zizmor
permissions:
security-events: write
# yamllint disable-line rule:line-length
uses: zizmorcore/workflow/.github/workflows/reusable-zizmor.yml@3bb5e95068d0f44b6d2f3f7e91379bed1d2f96a8
... |
@webknjaz I noticed this—I didn’t include it because I think it makes more sense to be able to run everything locally. If both options are available, I worry there could be a version conflict, where one tool reports something different from the other. Personally, I prefer to see everything locally for consistency. |
LOL I just noticed you wrote that 😄 i can format it out to sarif and display it... |
As for having a shared behavior — I prefer using a config file so all different invocations would pick it up. But the CLI toggles you use aren't available like that. Apparently, @woodruffw wanted people to use CLI args. Though, I would argue there's a case for allowing the defaults in the config too. |
Not exactly wanted -- it's more that |
TODO: change
--persona=regular
->--persona=pedantic
(in another PR)