Dependency Vulnerability Scanning Guide: SCA Tools, npm audit, Snyk, and CI/CD Integration
Dependency scanning — also called Software Composition Analysis (SCA) — is the practice of automatically identifying known vulnerabilities in the third-party libraries and packages your application uses. Given that modern applications are often 80-90% open-source code by volume, dependency vulnerabilities represent one of the largest and most commonly exploited attack surfaces in web security.
This guide covers the fundamentals of SCA, every major tool from free to enterprise, and how to integrate dependency scanning into your CI/CD pipeline without slowing down development.
Complement SCA with deployment checks: After fixing your dependency vulnerabilities, run ZeriFlow to verify that your deployed application's security configuration — headers, TLS, exposed paths — is also clean. It takes under a minute.
Why Dependency Scanning Matters: The SCA Problem
The Log4Shell vulnerability (CVE-2021-44228) affected thousands of organizations because they were running Java applications that included Log4j — often as a transitive dependency several levels deep in the dependency tree. Many teams did not even know they had Log4j in their stack.
This is the SCA problem in a nutshell:
- Direct dependencies are libraries you explicitly include (e.g.,
express,requests). - Transitive dependencies are libraries your dependencies include (often 5-10x more packages than direct deps).
- CVE databases (NVD, GitHub Advisory, OSV) track known vulnerabilities in these packages with severity scores.
- SCA tools cross-reference your dependency manifest against these databases.
A single vulnerable transitive dependency deep in your stack can expose your entire application to remote code execution.
Understanding SCA Fundamentals
How SCA Tools Work
- 1Manifest parsing: Read
package.json,requirements.txt,pom.xml,Gemfile.lock,go.sum, etc. - 2Dependency resolution: Resolve the full transitive dependency tree.
- 3CVE matching: Cross-reference every resolved package version against vulnerability databases.
- 4Reporting: Generate a report with CVE IDs, CVSS scores, affected versions, and fix versions.
- 5Fix guidance: Suggest specific version upgrades that resolve vulnerabilities.
Key CVE Databases
- NVD (National Vulnerability Database) — NIST's official US government CVE database.
- GitHub Advisory Database — GitHub's security advisory database, now one of the most comprehensive.
- OSV (Open Source Vulnerabilities) — Google's cross-ecosystem vulnerability database; free API.
- Snyk Vulnerability Database — Commercial database with additional researcher-sourced findings.
Tool Deep-Dive: Every Major SCA Option
npm audit (Node.js)
Built directly into npm, npm audit is the fastest way to check Node.js dependencies:
npm audit
npm audit --audit-level=high # Only show High and Critical
npm audit fix # Auto-fix by upgrading packages
npm audit fix --force # Fix breaking changes too (careful)Limitations: Only covers direct and transitive Node.js dependencies; no reporting formats; no CI/CD gate built in.
pip-audit (Python)
pip install pip-audit
pip-audit # Scan current environment
pip-audit -r requirements.txt # Scan from requirements file
pip-audit --format json > audit.json # JSON output for CIpip-audit queries the OSV database and is the recommended Python SCA tool.
OWASP Dependency-Check
The most widely used open-source, multi-ecosystem SCA tool:
dependency-check --project 'MyApp' --scan ./src --format HTMLSupports: Java, .NET, Node.js, Ruby, Python, PHP, and more. Generates HTML, JSON, XML, JUnit, and SARIF reports. Ideal for teams that need a self-hosted, no-cost, enterprise-capable SCA tool.
CI/CD integration (Maven):
<plugin>
<groupId>org.owasp</groupId>
<artifactId>dependency-check-maven</artifactId>
<version>9.0.0</version>
<configuration>
<failBuildOnCVSS>7</failBuildOnCVSS>
</configuration>
</plugin>Snyk
Snyk is the most developer-friendly commercial SCA platform:
npm install -g snyk
snyk auth
snyk test # Scan current project
snyk test --severity-threshold=high
snyk monitor # Upload to Snyk dashboard for continuous monitoringSnyk advantages: - Fix PRs — automatically opens pull requests to upgrade vulnerable packages. - License scanning — detect licenses incompatible with your commercial use. - Container scanning — scan Docker images for vulnerable OS packages. - Infrastructure as code scanning — scan Terraform and CloudFormation. - IDE plugins — real-time scanning in VS Code, IntelliJ.
Snyk has a generous free tier for open-source projects.
GitHub Dependabot
If you use GitHub, Dependabot is the lowest-friction SCA tool available:
- 1In your repository settings, enable 'Dependabot alerts' and 'Dependabot security updates'.
- 2Dependabot automatically opens PRs to fix vulnerable dependencies.
- 3No configuration required for basic functionality.
For advanced configuration, add .github/dependabot.yml:
version: 2
updates:
- package-ecosystem: npm
directory: '/'
schedule:
interval: weekly
open-pull-requests-limit: 10OSV.dev
Google's OSV (Open Source Vulnerabilities) project provides a free API for programmatic vulnerability lookups:
curl -X POST https://api.osv.dev/v1/query -d '{"package": {"name": "lodash", "ecosystem": "npm"}, "version": "4.17.20"}'OSV is particularly useful for building custom tooling or integrating vulnerability data into your own dashboards.
CI/CD Integration Strategies
GitHub Actions (npm)
name: Dependency Scan
on: [push, pull_request]
jobs:
dependency_scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- run: npm ci
- run: npm audit --audit-level=highGitHub Actions (Snyk)
- name: Snyk Security Scan
uses: snyk/actions/node@master
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
args: --severity-threshold=highGitLab CI with OWASP Dependency-Check
dependency_scan:
image: owasp/dependency-check:latest
script:
- /usr/share/dependency-check/bin/dependency-check.sh
--project 'MyApp'
--scan .
--format JSON
--failOnCVSS 7
artifacts:
paths:
- dependency-check-report.jsonBest Practices for Dependency Scanning
1. Scan lock files, not just manifest files. package-lock.json and yarn.lock contain the exact resolved versions of all transitive dependencies — far more accurate than package.json which only specifies version ranges.
2. Block on Critical, warn on High. A build policy that blocks on CVSS >= 9.0 (Critical) and warns on CVSS 7.0-8.9 (High) is a reasonable starting point. Never block on Medium without strong justification — too many false positives.
3. Schedule daily scans. New CVEs are disclosed daily. A weekly or daily scheduled scan in CI ensures you are notified when a new vulnerability is published for a dependency you already have.
4. Track false positives explicitly. When you accept a risk (e.g., a CVE that affects a code path you do not use), document it with a suppression file and a review date. Undocumented suppressions accumulate silently.
5. Combine SCA with DAST. SCA tells you about known vulnerabilities in your libraries. DAST tools like ZeriFlow tell you about configuration issues in your deployed application. Both are necessary — they cover completely different attack surfaces.
FAQ
Q: What is the difference between SCA and SAST?
A: SAST analyzes your own source code for insecure programming patterns. SCA analyzes your third-party dependencies for known CVEs. They are complementary — you need both.
Q: Can dependency scanning find zero-day vulnerabilities?
A: No. SCA tools only find vulnerabilities that have been publicly disclosed and added to CVE databases. Zero-days, by definition, are not in any database yet.
Q: How do I handle false positives in dependency scanning?
A: Most SCA tools support suppression files (e.g., dependency-check-suppressions.xml for OWASP Dependency-Check). Document your reasoning and set a review date. Re-evaluate suppressions quarterly.
Q: Should I update all dependencies immediately when a CVE is published?
A: Prioritize by exploitability. A Critical RCE CVE in a library you actively use should be patched within 24-48 hours. A Medium-severity CVE in a dev-only dependency can follow your normal release cycle.
Q: Does ZeriFlow check dependencies?
A: ZeriFlow focuses on configuration and header security scanning of deployed web applications — security headers, TLS, exposed paths, and 80+ related checks. For dependency vulnerability scanning, use npm audit, pip-audit, Snyk, or OWASP Dependency-Check. The two tools are complementary.
Conclusion: Start Scanning Your Dependencies Today
Dependency vulnerabilities are one of the most exploited attack vectors in modern web security — and they are almost entirely preventable with automated SCA. The tools are free, the integration is straightforward, and the ROI is immediate.
Start with the built-in tools for your ecosystem (npm audit, pip-audit) today. Add Dependabot for automatic fix PRs. Graduate to Snyk or OWASP Dependency-Check as your security program matures.
And complement your dependency scanning with ZeriFlow — your deployed application's configuration security is just as important as the libraries running inside it.