What is dependency scanning in CI/CD and how does it work?

Answer

Dependency scanning (also called software composition analysis, SCA) automatically identifies known security vulnerabilities in the third-party libraries and packages your application depends on. Modern applications import hundreds of open-source packages, each of which may contain published CVEs. In the CI pipeline, after installing dependencies, the scanner checks each package version against vulnerability databases (National Vulnerability Database, GitHub Advisory Database, Snyk's database) and reports any matches with severity scores. Tools include: Snyk (language-agnostic, developer-friendly, integrates with GitHub/GitLab PR checks), OWASP Dependency-Check (open-source, supports Java, .NET, Python, PHP), npm audit (built into npm for Node.js), Dependabot (GitHub's built-in tool that opens automated PRs for vulnerable dependency updates), and Renovate (automated dependency update PRs with configurable schedules). Best practice is to block merges on CRITICAL vulnerabilities and auto-merge Dependabot patches for development dependencies, while requiring human review for production dependency updates that may include breaking changes.