Fix zizmor security issues in GitHub Actions workflows#361
Fix zizmor security issues in GitHub Actions workflows#361
Conversation
Template SuccessWarning This is what the audit looks like when the templating has no errors. Templating Audit
Template ErrorWarning This is what the audit looks like when templating results in errors. Templating Audit
Got 1 error(s) |
|
The comment above is to be expected because of the change to the |
|
@jezdez any reason not to add zizmor as pre-commit hook via?: |
|
as this is the central repo maybe adding actionlint is also of additional help to find things before they come to the consumers of the actions: |
|
No, these are good ideas, you're right! But adding the actions wouldn't have made these changes |
|
Cannot make changes to the following here (as they're synced from conda/infrastructure):
edit: but I'm starting to wonder if some of the workflows should be synced from here instead, e.g., it makes more sense for the cla workflow to live here alongside the cla action? |
|
Can we combine cla-trigger with cla? Isn't it possible to define permissions per job instead of on the workflow level? |
Adds 7-day cooldown period to all Dependabot package ecosystem entries to prevent excessive update frequency. Applied by: zizmor v1.24.1 --fix (dependabot-cooldown rule)
Replace direct template expansions (${{ inputs.* }}) in run blocks,
github-script steps, and python steps with environment variables.
Inputs are now passed via env vars which are properly escaped by
the shell/runtime.
Detected by: zizmor v1.24.1 (template-injection rule)
- Add persist-credentials: false to all checkout steps - Add workflow-level permissions: contents: read - Add job-level permissions for template-files and analyze jobs that need write access to issues/pull-requests - Fix template injection in read-file test assertions by using environment variables instead of direct template expansion Detected by: zizmor v1.24.1 (artipacked, excessive-permissions, template-injection rules)
Workflows synced from conda/infrastructure (cla.yml, issues.yml, labels.yml, project.yml, stale.yml) cannot be modified in this repo. Suppress their findings here; fixes should be applied upstream.
208d3c8 to
f2ad403
Compare
|
Rebased the entire branch onto current main and re-ran zizmor v1.24.1 from scratch. The previous iteration was 40 commits behind and had conflicts. Addressing @kenodegard's feedback: Synced workflows ( The What's left:
Clean audit: |
f2ad403 to
0825b40
Compare
Rebased onto current main and re-audited with zizmor v1.24.1. The previous iteration touched synced workflows that are managed by conda/infrastructure; this version leaves those untouched and suppresses their findings in
zizmor.ymlinstead.What changed
Dependabot cooldowns (
dependabot.yml)zizmor --fix).Template injection fixes (action files)
${{ inputs.* }}expansions inrun:blocks with environment variables acrosscanary-release,combine-durations,create-fork,read-file,template-files.${{ inputs.* }}inactions/github-scriptsteps withprocess.env.*inread-yaml,set-commit-status,check-cla.${{ inputs.* }}in Python shell steps withos.environ[...]incheck-cla.Credential persistence (
tests.yml,check-cla/action.yml)persist-credentials: falseto allactions/checkoutsteps.Explicit permissions (
tests.yml)permissions: contents: read.template-filesandanalyzejobs that need write access.read-filetest assertions.Synced workflow suppressions (
zizmor.yml)cla.yml,issues.yml,labels.yml,project.yml,stale.yml,update.yml) cannot be modified here. Their findings are suppressed with documentation explaining why.Pre-commit hooks (
.pre-commit-config.yaml)zizmor(v1.24.1) andactionlint(v1.7.12) hooks, as suggested by @dbast.Audit result
Notes for reviewers
${{ inputs.* }}inwith:blocks passed to known-safe actions).zizmor.ymlfor synced workflows.