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.
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.
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.
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.
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.
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: - setting persist-credentials: false in all checkout runs - changing template substitutions to environment variable substitutions I added an ignore rule for dangerous-triggers to ignore the upload_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.
* Update trainer_utils import and save strategy in online_dpo_trainer.py * fix back-compat for online-dpo * better comment * Update transformers dependency to commit f33904
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: falsein all checkout runsI added an ignore rule for
dangerous-triggersto ignore theupload_pr_to_documentationworkflow 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.