-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Add zizmor for CI (security) linting #2288
base: main
Are you sure you want to change the base?
Add zizmor for CI (security) linting #2288
Conversation
These were all minor in the context of things but can be easily fixed, therefore they should. All template substitutions are now indirected by using environment variables. All checkouts are using `persist-credentials: false`.
Just to have a bit of a safety net regarding CI configs. If it is getting bothersome we can remove it again :)
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
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.
Thanks for improving the security of the PEFT workflows.
changing template substitutions to environment variable substitutions
Could you explain why this is more secure?
persist-credentials: false
Just to clarify, this is not a security issue on the repo as we're currently not using ssh, this is just a precaution, as that right?
Edit: For context, we wanted to harden the repo after the ultralytics hack.
|
||
on: | ||
push: | ||
branches: ["main"] |
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.
How about only executing this workflow if anything was changed inside of .github
using the path argument
? Or could we be missing something that way?
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.
Good idea, added accordingly.
dangerous-triggers: | ||
ignore: | ||
# this workflow is only triggered after maintainer approval | ||
- upload_pr_documentation.yml:3:1 |
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.
It's not beautiful but I don't know if there is anything else that we can do here.
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 zizmor documentatin recommends switching to the workflow_call
trigger which has the security benefit of not passing environment variables from one workflow to the other - they're more isolated.
FWIW it seems to be the better scheme for this workflow anyway but I'm not sure if there are unforeseen consequences.
Sure. With Contrast this to the behavior before: This is, of course, assuming that github action is not implementing the export FOO=${{ foo }} but rather as something like
Yes, this is just to make the linter happy and avoid accidents should we ever (for whatever reason) use manual triggers using SSH. |
@McPatate might be interested in this too, perhaps? |
To add a bit of a safety net to our CI jobs it might make sense to add a CI security linting tool such as zizmor.
The linting run should be green at the moment since I fixed all reported issues:
persist-credentials: false
in all checkout runsI added an ignore rule for
dangerous-triggers
to ignore theupload_pr_to_documentation
workflow as our actions are configured to only run such steps on approval which should already have seen at least maintainer eyes and the zizmor run.