Safeguard
Developer Tools•

How do you scan a pull request for vulnerabilities before merge?

Run dependency, code, secret and config checks on each pull request and fail only on new high severity findings. Steps, gate rules and mistakes.

Safeguard Security Team
3 min read

Scan a pull request by running fast checks on the changed files and dependencies, comparing the result with the base branch, and failing the check only on new high severity findings. This keeps the gate useful: developers fix what they introduced instead of inheriting every old finding.

What to run on a pull request

CheckWhy in the PRTypical gate
Dependency scanNew or updated packages are the main new riskNew critical or high with a fix available
Secret scanCheapest place to catch a credentialAny live looking secret
SAST on changed codeFlaws are easiest to fix before mergeNew high severity
Config scan on IaC and DockerfileMisconfigurations ship fastViolations of the chosen baseline

Steps

  1. Trigger the checks on every pull request and on pushes to the default branch.
  2. Scan the base branch for a reference result, then report only the difference.
  3. Post a short summary comment with the findings and fix hints.
  4. Make the check required in branch protection, otherwise it is advisory.
  5. Define an exception route with an owner and an expiry date.
  6. Decide what happens when the scanner is down. See block or pass when the scanner is down.

Make it trustworthy

A gate that fails often on old debt gets bypassed. Keep severity thresholds clear, allow a documented override, and track how often overrides happen. Also secure the CI job itself: pin the scanner version and limit its permissions. See hardening the job that runs your scanner.

Pull requests from forks

Forked pull requests run with fewer secrets for good reason. Do not hand scan credentials to untrusted code. Run the lightweight checks that need no secrets, and run deeper checks after a maintainer approves.

How Safeguard helps

Safeguard covers SBOM and dependency scanning, reachability analysis, and policies and gates that apply in pull requests. The free scan is a quick way to see your dependency findings.

Try it yourself

Click through it at your own pace, or open it full screen.

Watch what blocks the merge and what only warns.

Quick check

Should the gate fail on all findings?

No. Fail on new high severity findings and manage older ones through a backlog.

Is a PR scan enough on its own?

No. New advisories appear after merge, so also run scheduled scans.

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.