Registry / devops / snyk-nuget-plugin

snyk-nuget-plugin

JSON →
library4.2.1jsnpmunverified

Snyk CLI plugin for NuGet dependency analysis. Current stable version 4.2.1, released April 2026. Requires Node >=16. Ships TypeScript types. Scans project.json, packages.config, and project.assets.json to identify vulnerabilities. Key differentiator: first-class Snyk integration with dotnet restore, supports case-insensitive resolution and runtime flags. Breaking changes in v3/v4 removed legacy scanner flags. Used internally by snyk CLI; not typically installed directly.

npm install snyk-nuget-plugin
INSTALL
IMPORT
SIG · SNYK-NUGET-PLUGIN
S
snyk-nuget-plugin
devopsjavascriptv4.2.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

inspect
import { inspect } from 'snyk-nuget-plugin'
const inspect = require('snyk-nuget-plugin').inspect
ESM export; named import required.
buildDepTreeFromProjectJson
import { buildDepTreeFromProjectJson } from 'snyk-nuget-plugin'
import buildDepTreeFromProjectJson from 'snyk-nuget-plugin'
Named export, not default.
buildDepTreeFromPackagesConfig
import { buildDepTreeFromPackagesConfig } from 'snyk-nuget-plugin'
const { buildDepTreeFromPackagesConfig } = require('snyk-nuget-plugin')
ESM-only since v3; CJS require not supported.
buildDepTreeFromProjectAssets
import { buildDepTreeFromProjectAssets } from 'snyk-nuget-plugin'
For .assets.json files.

Shows how to import the inspect function, run dotnet restore, and scan a NuGet project's assets file for vulnerabilities.

import { inspect } from 'snyk-nuget-plugin'; import { execSync } from 'child_process'; import * as fs from 'fs'; const targetFile = 'path/to/project.assets.json'; // Ensure .NET SDK is installed and restore has been run const projectFolder = 'path/to/project'; try { execSync('dotnet restore', { cwd: projectFolder, stdio: 'pipe' }); } catch (e) { console.error('dotnet restore failed:', e.stderr?.toString() || e.message); process.exit(1); } inspect('.', targetFile) .then((result) => { console.log('Scanned successfully:', result.package?.name); console.log('Dependencies:', JSON.stringify(result.dependencyTree, null, 2)); }) .catch((err) => console.error('Inspect failed:', err));
Debug
Known issues
breakingRemoved useImprovedDotnetWithoutPublish and useFixForImprovedDotnetFalsePositives flags in v3.0.0
fix
Remove these flags from configuration; they are no longer accepted.
affects: >=3.0.0
breakingRemoved useImprovedDotnetWithoutPublish and useFixForImprovedDotnetFalsePositives flags (reinstated in v4.0.0 revert) – v3.1.0 also removed them
fix
Upgrade to v4.1.0+ to avoid removal; ensure flags are not used.
affects: 3.0.0
deprecatedThe entire package is an internal Snyk plugin; direct usage outside Snyk CLI is deprecated and unsupported.
fix
Prefer using the Snyk CLI tool to invoke plugin indirectly.
affects: >=3.0.0
gotchaRequires dotnet CLI installed and accessible; dotnet restore must succeed before scanning.
fix
Install .NET SDK and run dotnet restore in the target directory.
affects: >=2.0.0
gotchaTypeScript types may be incomplete; some API surfaces lack strict typing for edge cases.
fix
Use type assertions or update to latest version.
affects: >=2.0.0 <4.2.0
Errors
Common errors & fixes
Error: Cannot find module 'snyk-nuget-plugin'
Package not installed or not in node_modules
fix
Install as dependency: npm install snyk-nuget-plugin
TypeError: inspect is not a function
Incorrect import: default import used instead of named import
fix
Use import { inspect } from 'snyk-nuget-plugin' instead of import inspect from 'snyk-nuget-plugin'
dotnet restore failed with exit code 1
dotnet restore command failed, usually due to missing .NET SDK or network issues
fix
Install .NET SDK >=6.0 and ensure internet access for NuGet restore
Upgrade
Version history
4.2.1latest on npm
Audit
Dependencies
@snyk/dep-graphoptionaldependency graph construction
debugoptionaldebug logging
Agent activity
12 hits · last 30 days
node
10
OpenAI (training)
1
Resources
snyk-nuget-plugin — npm install snyk-nuget-plugin · libregistry