Repository navigation
[ci] Fail the source scan only on findings a change introduces - #3318
Conversation
On pull requests and pushes the scan covered the whole tree and failed on any HIGH or CRITICAL finding, so every change to a Dockerfile failed on findings that are already on trunk. It now also scans the base commit and fails only on findings that the base does not have. Scheduled runs are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PR Summary by QodoFail source scans only for newly introduced findings
AI Description
Merge Risk
|
Code Review by Qodo
1.
|
…g with trunk Comparing a force-pushed branch with trunk would report findings that were already on the branch as new. Fetch the previous tip when it is not in the checkout, and fail with a clear error if it is not available. The trunk fallback is kept for new branches only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Thanks for contributing to the Docker-Selenium project!
A PR well described will help maintainers to quickly review and merge it
Before submitting your PR, please check our contributing guidelines, applied for this repository.
Avoid large PRs, help reviewers by making them as simple and short as possible.
Description
scan-source.ymlruns Trivy (secret,misconfig) on the whole tree. On pull requests and pushes it failed on any HIGH or CRITICAL finding, including findings that are already on trunk. Because the workflow only runs when a Dockerfile changes, every PR touching a Dockerfile failed (for examplerenovate/ubuntu-updatesince Nov 19, and #3317).Findings already on trunk, all in files those PRs do not touch:
charts/selenium-grid/certs/tls.key(test certificate,private-key)kubernetes/**and.keda-external-scaler/deploy/deployment.yamlexamples (KSV-0014,KSV-0118)Base/DockerfileENV defaults (DS-0031)Changes:
scripts/ci/new_scan_findings.pycompares the two SARIF reports by rule, file and message, so moved code does not count as new..cache(the Trivy cache inside the checkout) is skipped in both scans so they cover the same files.Tested locally with Trivy 0.76.2:
trunk, headlog-level-in-script-logs([build] Add log level to script logs and use one timestamp format #3317, changesBase/Dockerfile): no new findings, exit 0.private-key in Base/planted.key), exit 1.tests/ci/test_new_scan_findings.py.Motivation and Context
The workflow comment says a secret or misconfiguration in a change is the author's to fix. The scan failed PRs for findings they did not introduce.
Types of changes
Checklist
🤖 Generated with Claude Code