Safeguard
Security Guides•

How do you scan a GitHub repository for vulnerabilities?

Cover four things when scanning a GitHub repo: dependencies, your own code, secrets and infrastructure files. Steps, a checklist table and results.

Safeguard Security Team
3 min read

To scan a GitHub repository for vulnerabilities, run four checks: dependency scanning for known CVEs in packages, static analysis for flaws in your own code, secret scanning for committed credentials, and configuration scanning for Dockerfiles and infrastructure files. One tool rarely does all four equally well.

The four checks

CheckFindsReads
Dependency scan (SCA)Known vulnerable packagesLockfiles and manifests
Static analysis (SAST)Flaws in code you wroteSource files
Secret scanCommitted credentialsFiles and full git history
Config scanMisconfigured Dockerfile, Terraform, KubernetesIaC and build files

Steps

  1. Start with dependencies, because that is where most known CVEs live. Make sure your lockfile is committed, so the scan sees exact versions. See which file to scan.
  2. Add secret scanning across all branches and history.
  3. Add SAST for your own code in pull requests.
  4. Scan Dockerfiles and infrastructure files in the same pull request.
  5. Gate merges on new high severity findings, not on the whole backlog.
  6. Schedule a weekly full scan, since advisories change after you merge.

Where results should land

Put findings where developers already look: the pull request check, the repository security tab or a ticket queue. Scanners that produce SARIF 2.1.0 can upload to GitHub code scanning, which accepts only that SARIF version and caps a file at 10 MB compressed.

Public and private repositories

Public repositories can be scanned by anyone who can read them. For private repositories, give the scanner the narrowest access it needs, read only if possible, and review that access when the pilot ends.

Reading the first results

A first scan often returns a long list. Sort by severity, whether a fix exists and whether the vulnerable code is reachable. Fix the top handful, record the rest with owners, and set a rule that prevents new ones. See your first hour with scan results.

How Safeguard helps

Safeguard provides SBOM and dependency scanning with reachability analysis, and policies, gates and guardrails you can apply before merge. You can try the free scan on a repository.

Try it yourself

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

Open the dependency inventory and find direct versus transitive packages.

Quick check

Is one scanner enough for a repository?

Usually not. Dependencies, code, secrets and configuration are different problems, and coverage varies by tool.

Do I need to commit my lockfile?

Yes, for accurate results. Without it the scanner has to guess versions.

Sources

  • GitHub Docs, SARIF support for code scanning (fetched 19 October 2026).
  • GitHub Docs, About secret scanning (fetched 19 October 2026).

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.