Product

Product Features SDLC How to Compare Docs Screenshots

Start here

Getting started Download Questions

More

Security Roadmap About

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

  1. 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
  2. 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-on then counts only new findings, and policy applies the pull request gate's policy.

    ghscan review . --base origin/main --head HEAD --fail-on policy
  3. 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.

  4. 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.

  5. Add --fail-on critical once the backlog is dealt with, not before.

  6. 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
  7. 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