Safeguard
Developer Tools•

Can SCA policy differ by directory inside one monorepo?

A monorepo often holds services of different risk. Learn how path scoped SCA policy, ownership and exceptions should work, and how to test a tool for it.

Safeguard Security Team
4 min read

It should. A monorepo can hold a payment service and a docs site, and one repository level policy treats them the same. A good SCA tool lets policy, ownership and exceptions attach to a directory or package, with sensible inheritance from the repo and organization defaults.

The problem with repo level everything

Most SCA tools were designed around one repository, one owner, one policy. In a monorepo that breaks in three places:

  • A strict gate for the payments folder blocks an unrelated documentation change.
  • A single owner receives findings for 40 teams' code.
  • An exception granted for one package silently applies to all.

Three things that need path scope

Ownership

GitHub's CODEOWNERS shows the pattern: path patterns map to owners, and when several match, the last matching pattern wins. Owners must be users or teams with write access. The file must be on the pull request base branch, and files over 3 MB are not loaded (see Sources). An SCA tool can reuse this: take the manifest path, find the matching owner, and route the finding there.

Policy

Ask whether a rule can be set for a path, such as stricter blocking under services/payments/. The effective policy for a manifest should be the org default, then the repo, then the path, with each layer allowed to tighten freely.

Exceptions

An exception should name the package, the version and the path it covers. Otherwise a "temporary" exception in one service hides the same vulnerable library in another.

A test plan

  1. Create a monorepo with two directories and different owners.
  2. Add the same vulnerable library version to both.
  3. Set a stricter policy on one path.
  4. Open a pull request touching only the lenient path. It should not fail on the strict path's rules.
  5. Grant an exception for one path. Confirm the other still reports.
  6. Check where each finding is routed.
  7. Count: does one underlying advisory show as one issue per path, or one per file, or one total? See count one vulnerability across many monorepo packages.

Pull request behavior

Path scope also matters in CI. Per package scans, triggered by changed paths, keep checks fast and make failures relevant. See GitHub Actions path filters for per package scans. Ask whether the SCA check reports a result per affected package and whether an unrelated failure can block the whole merge.

How rules should combine

LayerExample ruleCan it loosen the layer above?
OrganizationBlock new critical findingsNot applicable
RepositoryAlso block high in production codeNo, only with approval
PathBlock medium under the payments folderNo, only with approval

Document the map

Keep the path to owner and path to policy map in the repository or a catalog, and review it when directories move. See CODEOWNERS paths after moving a repo into a monorepo subdirectory.

Watch the failure modes

  • Path patterns that miss new directories, leaving them with default policy and no owner.
  • Overlapping rules that nobody can explain. Prefer a few clear paths over many clever ones.
  • Generated or vendored folders counted as first party code.

Safeguard provides policies, gates and SBOM and dependency scanning that you can try on a monorepo through the free scan at gold.safeguard.sh/scan.

Quick check

Do we need separate repos to have separate policy?

No, if the tool supports path scope. If it does not, repo level policy will either over block or under protect.

What happens to new directories?

They inherit the repo default and may have no owner. Check for unowned paths regularly.

Sources

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.