Skip to content

feat(detector): add .NET/NuGet inventory and configuration audit - #239

Open
raysubham wants to merge 5 commits into
step-security:mainfrom
raysubham:feat/nuget-inventory
Open

raysubham wants to merge 5 commits into
step-security:mainfrom
raysubham:feat/nuget-inventory

Conversation

@raysubham

@raysubham raysubham commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds passive .NET/NuGet package inventory and NuGet.Config audit to enterprise telemetry through optional nuget_inventory and nuget_config_audit sections.

  • Collects declared requirements from SDK-style projects (PackageReference, PackageDownload, MSBuild SDKs), central Directory.Packages.props versions and GlobalPackageReference, and legacy packages.config.
  • Collects restored packages from project.assets.json, locked packages from packages*.lock.json, cached packages from global, fallback and configured caches, global/local .NET tools, installed templates, *.deps.json binary dependencies, and C#/F# file-based app directives.
  • Verifies installed identities against the package's nuspec; cache, tool and template evidence is emitted only when the on-disk metadata matches.
  • Audits allowlisted NuGet.Config settings across project, user, machine and process scopes, plus project-level NuGet properties. Credentials, proxy secrets and credential-provider paths are reported as presence only. Emits findings nuget-001 through nuget-004.
  • Reuses the Go/Cargo/Composer guarded filesystem access, developer selection, source coverage and collection limits. Unparsed, unreadable, cancelled or budget-limited inputs leave their sources partial so prior evidence is never retired on unproven absence.
  • Adds the shared producer/backend golden fixture and parser, scanner, configuration, limit, cancellation and redaction regressions.

The collector never executes dotnet, NuGet, MSBuild, credential providers, scripts or discovered binaries, and never reads credential contents. XML input rejects DTDs; .nupkg archives are read bounded and never extracted. Community output remains unchanged. Updates README and scan-coverage documentation. Release versioning stays unchanged.

Type of change

  • Bug fix
  • Enhancement
  • Documentation

Testing

  • Tested on macOS 27.0: local unit tests and smoke checks
  • Binary runs without errors: make smoke (45 checks)
  • JSON output is valid: covered by the smoke suite
  • No secrets or credentials included
  • Lint passes: golangci-lint run ./..., go vet ./..., and gofmt
  • Tests pass: go test ./... -race -count=1

Also verified CGO-disabled builds for linux/amd64, darwin/arm64 and windows/amd64, and module consistency. Gosec reports the 24 pre-existing findings, none in NuGet files.

Native VM scanning and deployed REST/MCP acceptance remain pending.

Related Issues

Builds on the Composer scanner and configuration helpers from #238 (merged).

@raysubham
raysubham force-pushed the feat/nuget-inventory branch from a04271c to 0dd07a1 Compare October 15, 2026 16:51
Add passive NuGet package inventory and NuGet.Config audit to enterprise
telemetry as optional nuget_inventory and nuget_config_audit sections.

The scanner reads SDK-style and legacy project metadata, central package
versions, restore graphs, lock files, global/fallback/custom caches, .NET
tools, templates, deps.json and file-based app directives. It never runs
dotnet, NuGet, MSBuild, credential providers or scripts, and never reads
credential contents. Unparsed or unreadable inputs leave their sources
partial so prior evidence is not retired.
Charge each source, project and package record against the 16 MiB output
budget as it is admitted, reserving the config audit's 256 KiB cap up front.
Once the budget is spent, collection stops and the affected sources are
marked partial with output_size_limit, so records already collected are kept
instead of the whole inventory being discarded, and missing records never
read as package removal.
@raysubham
raysubham force-pushed the feat/nuget-inventory branch from 0dd07a1 to a17c5de Compare October 15, 2026 17:07

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant