feat(ci): real CodeQL + Trivy scanner configuration#3
Open
ashvinctrl wants to merge 1 commit into
Open
Conversation
CodeQL: - Add .github/codeql/codeql-config.yml using security-and-quality query suite (catches injection, SSRF, path traversal, etc.) - Add permissions block (security-events: write) so SARIF upload works on private repos without silent failure - Add category parameter for clean Security tab grouping Trivy: - Add filesystem scan (secrets + misconfigs) in security-scan job — runs on source checkout, no Docker needed - Update image scan from @0.20.0 to @0.28.0 - Add exit-code: 1 so CRITICAL/HIGH CVEs actually fail the build - Add severity: CRITICAL,HIGH gate with ignore-unfixed: true - Add misconfig + secret scanners to image scan - Add .trivyignore for suppressing accepted false positives - Upload both FS and image scans to separate SARIF categories Other: - Replace deprecated safety check with pip-audit - Add -ll -ii flags to bandit so it only fails on MEDIUM+ severity and MEDIUM+ confidence (reduces noise from low-severity findings)
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.
What was broken
permissionsblock so SARIF upload silently failed on private repos.@0.20.0(2022). Noexit-codeso it never failed the build. No misconfig or secret scanning.safety checkbanditWhat changed
.github/codeql/codeql-config.yml(new)security-and-qualityquery suite: injection, SSRF, path traversal, insecure deserialization, etc.src/testsand cache dirs from analysis.trivyignore(new)ci-cd.ymlsecurity-scanjob: addedpermissionsblock, CodeQL config reference,categoryparam; added Trivy filesystem scan (secrets + misconfigs on source checkout, no Docker needed)docker-buildjob: Trivy updated to@0.28.0, addedexit-code: 1,severity: CRITICAL,HIGH,ignore-unfixed: true,scanners: vuln,secret,misconfig; both FS and image results go to separate SARIF categories in the Security tabtestjob:safetyreplaced withpip-audit; bandit now uses-ll -ii(MEDIUM+ severity, MEDIUM+ confidence)Security tab
After merge, GitHub Security → Code scanning will show three sources: