feat(lint): add upload-sarif input to skip GitHub code scanning upload#249
Merged
Conversation
The checkov/trivy/zizmor jobs always uploaded SARIF via github/codeql-action/upload-sarif, which requires GitHub Advanced Security. On private repos without GHAS the upload fails with "Resource not accessible by integration", breaking the whole lint job. Add an `upload-sarif` input (default true, fully backward-compatible). When set to false, the three scanners run with console output and gate on their exit codes instead of uploading SARIF, so private repos without GHAS can still enforce security linting.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The reusable
lint.ymlworkflow'scheckov,trivy, andzizmorjobs always upload their results viagithub/codeql-action/upload-sarif, which requires GitHub Advanced Security (code scanning). On private repos without GHAS, the upload step fails with:…which fails the whole lint job — even when the scanners themselves found nothing. There was no way to opt out of the SARIF upload, so these three security scanners were effectively unusable on private repos without a GHAS license.
Solution
Add a new
upload-sarifinput (boolean, defaulttrue— fully backward-compatible):true(default): unchanged behavior — scanners emit SARIF and upload to GitHub code scanning.false: thecheckov/trivy/zizmorjobs run with console output and gate on their exit codes instead of uploading SARIF. Findings still block the build (whenlint-fail-on-error: true); results appear in the job logs instead of the Security tab.Each job branches internally on the input (single run step), and the
Upload SARIF reportsteps are guarded withif: ${{ ... && inputs.upload-sarif }}.Notes
security-events: write(job permissions are static and can't be conditional), but no upload — and therefore no GHAS — is required whenupload-sarif: false.workflow-templates/lint.ymldocuments the new input.actionlint,yamllint(central config), andzizmorall pass on the edited workflow.Motivation
Unblocks the private
DevSecNinja/second-brainrepo (no GHAS) from adopting the org-standard security lint (see DevSecNinja/second-brain#11).