Safeguard
Developer Tools•

Exclude a folder from scanning or suppress the finding?

Exclude a path when code never ships, like fixtures and samples. Suppress a finding when code ships but one issue does not apply. How to choose.

Safeguard Security Team
3 min read

Exclude a folder from scanning when nothing in it ships or runs in production, such as test fixtures or sample projects. Suppress an individual finding when the code ships but a specific advisory does not apply. Exclusion changes what you scan. Suppression records a decision about one risk.

Two tools, two jobs

Path exclusionFinding suppression
Question it answersShould this code be scanned at all?Does this issue matter here?
ScopeA directory or file patternOne advisory in one place
Needs evidenceThat the code does not shipThat the issue does not apply
End dateReview when the folder changesRequired

Mixing them causes trouble. A broad path rule used to quiet a noisy finding in shipping code is a silent hole.

When exclusion is right

  • Test fixtures that include old vulnerable manifests on purpose, for example to test a parser.
  • Sample applications in documentation folders that no one deploys.
  • Generated output or build caches that duplicate real sources.
  • Third party copies you scan elsewhere under their own name.

Check the claim. "It is only a test" is not proof. Look at what the build packages, and at whether CI deploys anything from that folder.

When exclusion goes wrong

  • A test folder holds a helper that production code imports.
  • A samples folder is copied into a container image by a loose copy rule.
  • A new service is created inside an excluded folder and nobody notices.
  • A pattern like a wildcard matches more than intended.

How to exclude safely

  1. List what the exclusion covers by running the pattern and reading the matched paths.
  2. Confirm the build and container steps never include them. Search copy commands and packaging rules.
  3. Write the pattern, the reason and the owner next to the exclusion.
  4. Review the matched paths again each quarter, or when the repository layout changes.
  5. Keep fixtures that intentionally contain vulnerable packages in one clearly named folder so the rule stays tight.

When suppression is right

Use suppression for shipping code. Name the advisory, the package, the version and the project, give the reason and evidence, and set an end date. See scope guidance.

A middle path for dev only code

Some ecosystems let you mark dependencies as development only. Scanning them is still useful, since build tools run in CI where secrets live. If you lower the priority rather than hide them, you keep visibility. Our post on dev dependencies explains why.

A quick audit

Once a quarter, list every exclusion pattern and print the files it matches. If the list is longer than you expected, or includes a directory that holds shipped code, tighten the pattern the same day. Exclusions grow quietly, so give them the same review as suppressions.

Quick check

Can I exclude a test directory without review?

Make it reviewed once, with a note that nothing from it ships. After that, review quarterly.

Does exclusion remove the findings from my SBOM?

It removes the excluded components from what the scan sees, so state the exclusion wherever you share the SBOM.

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.