Pipelines
Fail a build, without failing every build
Failing a build on any critical finding, in a repository that already has forty of them, fails every build from the first minute and gets switched off by the end of the week. Start narrow.
What to do
-
Run the scanner against only what changed, with
--diff origin/main. What comes back is everything in the files this branch touched.ghscan review . --diff origin/main --fail-on secrets -
To fail only on what the branch added, and not on old findings in the files it happened to touch, give it both commits.
--fail-onthen counts only new findings, andpolicyapplies the pull request gate's policy.ghscan review . --base origin/main --head HEAD --fail-on policy -
Start with credentials only. Almost nobody argues with a build that fails because somebody committed a key, and it is the finding with the shortest fuse.
-
If you want the strongest possible signal and nothing else, use
--fail-on verified-secrets. That fails only when the provider itself confirmed the key still works. -
Add
--fail-on criticalonce the backlog is dealt with, not before. -
Write the SARIF file out and hand it to whatever already reads SARIF, so the findings that did not fail the build are still visible somewhere.
ghscan review . --format sarif > findings.sarif -
To hold merges across many repositories without putting the engines on every build agent, use the pull request gate instead: the server does the review and the build only asks.
A tip
Uploading SARIF to a code host uses the pipeline's own token, not this product's. That is how annotations appear on a pull request without the scanner ever holding write access to anything.
Other guides
Draft a dynamic check with AI
Say what to find in a sentence, review what comes back, and turn it on.
ReadCheck whether one user can read another user's data
Two test accounts, a sentence about each, and a screenshot from both sides.
ReadAsk for and change an exception through the API
Your own requests, from a script, limited to what you can see.
Read