Safeguard
Supply Chain•

What does NuGet package source mapping not protect against?

Package source mapping filters restore, install and update, but not metadata queries or cached packages. Know these gaps before you rely on it.

Safeguard Security Team
4 min read

Package source mapping filters which feed NuGet downloads from during restore, install and update. It does not filter metadata lookups such as dotnet list package or dotnet add package, it is skipped for packages already in the global packages folder, and it cannot judge whether a package is trustworthy. These are documented limits.

Gap 1: metadata queries

Microsoft's documentation says mapping applies when NuGet downloads packages. Commands that look up package information, including adding a package and listing outdated, deprecated or vulnerable packages, send the requested IDs to all configured sources. That includes public ones.

Why it matters: if you have a private package named Contoso.Billing, a metadata command may ask nuget.org whether such a package exists. The query itself reveals the name. Tracking issues for this are linked from the docs.

Gap 2: the global packages folder

When a requested package is already in the global packages folder, no source lookup happens and mappings are ignored. A package that arrived before you enabled mapping, or from a different checkout, will be reused.

Mitigations from the docs:

  1. Declare a repository specific global packages folder.
  2. Clear the global packages folder with the locals command when you onboard.
  3. Restore again and fix any package that does not match a mapping.

Gap 3: older tooling

Older tools ignore the mapping configuration. The feature needs NuGet 6.0 or later, the .NET SDK 6.0.100 or later, or nuget.exe 6.0.0 or later. A build agent with an old SDK would restore without it.

Gap 4: it does not vet content

Mapping tells NuGet where a package ID may come from. It says nothing about whether the package on that feed is malicious, vulnerable or unmaintained. If you map everything to nuget.org with the star pattern, a malicious package published there is still allowed.

Gap 5: configuration drift

Settings follow normal nuget.config precedence, so an extra file elsewhere can change behavior. There are also no dotnet or nuget.exe commands to manage mappings, so edits are manual or through Visual Studio.

What to pair it with

RiskPair mapping with
Malicious or typosquatted packageReview of new dependencies, signature policy, prefix reservation signals
Vulnerable packageNuGet Audit with transitive checking, and a scanner
Unpredictable restoresLock file and locked mode in CI
Name leakage in queriesKeep internal names unlikely to collide, use a single upstreaming feed
Stale cacheClean or repository specific package folders in CI

A short checklist

  1. One repository nuget.config with clear elements.
  2. Mapping for every package ID, including transitive ones.
  3. A CI agent that starts from a clean cache.
  4. Current SDK versions everywhere.
  5. Review changes to nuget.config like code.

Try it yourself

Click through it at your own pace, or open it full screen. Mapping needs a full package list, and this is what that list looks like.

Safeguard's dependency scanning and SBOM output cover the content side that mapping leaves open, and a free scan is a place to start.

Quick check

Does package source mapping hide my private package names from nuget.org?

Not for metadata commands. Those send package IDs to every configured source.

Why did mapping not stop a package from an unexpected source?

It may already have been in the global packages folder, where mappings are not consulted.

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.