-
Notifications
You must be signed in to change notification settings - Fork 483
fix: compile zizmor fails by default on high severity findings #50872
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -202,9 +202,9 @@ func compileSpecificFiles( | |
| return workflowDataList, err | ||
| } | ||
| if err := RunZizmorOnFiles(lockFilesForZizmor, config.Verbose && !config.JSONOutput, config.Strict); err != nil { | ||
| if config.Strict { | ||
| return workflowDataList, err | ||
| } | ||
| // Always fail on high/critical severity findings (zizmor returns errors for those | ||
| // regardless of strict mode). In strict mode, all findings are errors. | ||
| return workflowDataList, err | ||
|
Comment on lines
204
to
+207
Comment on lines
+205
to
+207
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [/diagnosing-bugs] No regression test guards this fix — the bug could silently reappear if the Add a unit or integration test that calls @copilot please address this. |
||
| } | ||
| } | ||
|
|
||
|
|
@@ -514,9 +514,7 @@ func compileAllFilesInDirectory( | |
| return workflowDataList, err | ||
| } | ||
| if err := RunZizmorOnFiles(lockFilesForZizmor, config.Verbose && !config.JSONOutput, config.Strict); err != nil { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same broken pattern as the other call site: 💡 DetailsSee the companion comment on line 204 for the full call-chain explanation ( |
||
| if config.Strict { | ||
| return workflowDataList, err | ||
| } | ||
| return workflowDataList, err | ||
| } | ||
| } | ||
|
|
||
|
|
||
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.
This change is a no-op for the stated goal:
RunZizmorOnFilesreturning an error here still gets swallowed byhandleBatchToolError(inpkg/cli/compile_external_tools.go) wheneverstrictis false, so high/critical zizmor findings will not fail compilation in non-strict mode despite this diff.💡 Why this doesn't fix the bug
The call chain is:
and
handleBatchToolErroris:Regardless of why
runZizmorOnFilesreturned an error (including the new high/critical-severity error path),handleBatchToolErrorunconditionally returnsnilwhenstrictis false. Removing theif config.Strict { return ... }guard at the call site incompile_pipeline.gotherefore has no effect: the error never reaches this call site to begin with whenstrictis false, because it was already discarded one layer down.I verified this experimentally by adding a throwaway unit test that calls
runBatchLockFileTool("zizmor", ..., strict=false, ...)with a runner returning a high-severity-style error — it returnsnil, confirming the swallow happens beforeRunZizmorOnFilesreturns tocompile_pipeline.go.Suggested fix:
handleBatchToolErrorneeds to distinguish "must always fail" errors (e.g. wrap them in a sentinel type or check severity) from ordinary warnings, orRunZizmorOnFiles/runZizmorOnFilesneeds to bypasshandleBatchToolErrorentirely for the high/critical path and return the raw error directly to the caller instead of going through the shared warning-swallowing helper.This should also get a regression test asserting that a high-severity zizmor error surfaces as a real error when
strict=false.