Safeguard
Security Guides•

Which files in a repository should a security scan cover?

A good repository scan reads lockfiles, source, Dockerfiles, IaC, CI workflows and config. A file-by-file table of what to scan and what each reveals.

Safeguard Security Team
3 min read

A good repository scan reads more than source code. It should cover lockfiles for dependencies, source files for code flaws, Dockerfiles, infrastructure files, CI workflow files and config files, plus the git history. Each file type exposes a different class of risk.

File by file

File typeExamplesWhat a scan finds
Lockfilespackage-lock.json, poetry.lock, Cargo.lock, go.sumExact versions with known vulnerabilities
Manifestspackage.json, requirements.txt, pom.xmlDeclared dependencies, ranges
Source.py, .js, .java, .go, .rsInjection, unsafe calls, hardcoded secrets
DockerfileDockerfileRoot user, unpinned base, secrets in build args
IaC.tf, Kubernetes YAML, Helm valuesPublic exposure, privileged workloads
CI workflowsGitHub Actions, pipeline YAMLUnpinned actions, broad permissions, secret echo
Env and config.env, application.ymlCommitted credentials
Git historyAll commitsSecrets removed from the tip but still stored

Why lockfiles come first

A manifest may say a range, while the lockfile says the exact version that was installed. Vulnerability matching needs exact versions. Rust's cargo-audit, for example, reads Cargo.lock for this reason. Without a lockfile the scanner has to resolve versions itself, which can differ from what you ship.

Files people forget

  • CI workflow files. They define who can push to production and which third party steps run. Pin external steps to a full commit and limit token permissions.
  • Test fixtures and sample configs. They often contain real looking credentials.
  • Notebook files and scripts in tools folders.
  • Generated code and vendored copies of libraries, which may hide old versions.

What to leave out

Build output and downloaded dependency folders, unless you scan them deliberately. Scanning them adds noise and duplicates findings from the lockfile. Keep the exclusion list short and written down, because an exclusion hides risk silently.

Steps

  1. List the file types your repository holds using the table above.
  2. Check that your scanner covers each, and note the gaps.
  3. Commit lockfiles.
  4. Review exclusions once a quarter.
  5. Compare files scanned with files expected after each setup change.

How Safeguard helps

Safeguard offers dependency scanning and SBOMs, reachability analysis, and autonomous remediation with fix pull requests, which is off by default with every category on Manual. The free scan is the easiest first step.

Try it yourself

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

See which package files the inventory reads and how versions are resolved.

Quick check

Do I need to scan node_modules?

Usually no. The lockfile already identifies the packages, and scanning the folder duplicates results.

Why scan CI workflow files?

They control builds and deployments, and unpinned steps or broad token permissions are a supply chain risk.

Sources

  • RustSec cargo-audit README (fetched 19 October 2026): lockfile based auditing.

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.