SECURITY ENGINEERING · PART 9 · DEVSECOPS AND SUPPLY CHAIN · SCA · 123 OF 229

SCA Tools: Snyk, Trivy, Grype, Dependency-Check

Most of your application is other people's code, and most of its known vulnerabilities live there. This episode explains software composition analysis: how it finds vulnerable dependencies from lockfiles, why most risk is transitive, the tools (Snyk, Trivy, Grype, Dependency-Check), license and malicious-package checks, and how to run SCA so it blocks the right things without drowning developers.

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 9
  9. 10
  10. 11
  11. 12
  12. 13
  13. 14
  14. 15
  15. 16
  16. 17
  17. 18
  18. 19
  19. 20
  20. 21
  21. 22
  22. 23
  23. 24
  24. 25
  25. 26
  26. 27
  27. 28
  28. 29
  29. 30
  30. 31
  31. 32
  32. 33
  33. 34
  34. 35
  35. 36
  36. 37
  37. 38
  38. 39
  39. 40
  40. 41
  41. 42
  42. 43
  43. 44
  44. 45
  45. 46
  46. 47
  47. 48
  48. 49
  49. 50
  50. 51
  51. 52
  52. 53
  53. 54
  54. 55
  55. 56
  56. 57
  57. 58
  58. 59
  59. 60
  60. 61
  61. 62
  62. 63
  63. 64
  64. 106
  65. 107
  66. 108
  67. 109
  68. 110
  69. 111
  70. 112
  71. 113
  72. 114
  73. 115
  74. 116
  75. 117
  76. 118
  77. 119
  78. 120
  79. 121
  80. 122
  81. 123
  82. 124
  83. 125
  84. 126
  85. 127
  86. 128
  87. 129
  88. 130
  89. 131
  90. 132
  91. 133
  92. 134
  93. 135
  94. 136
  95. 137
  96. 138
  97. 139
  98. 140
  99. 141
  100. 142
  101. 143
  102. 144
1 / 10

Press play to hear the narration, or step through at your own pace.

Key takeaways

  • Most of your app and its bugs are dependencies
  • scan the lockfile including transitive
  • rescan continuously

Notes

What you depend on

First, understand what you depend on. Direct dependencies are the libraries you deliberately added. Transitive dependencies are what those libraries depend on, several levels deep. A handful of direct dependencies routinely pulls in hundreds. And the crucial point: most vulnerabilities turn up in transitive dependencies you never chose or heard of. The lockfile, which pins the exact version of every package, is the authoritative record of what you actually ship.

Direct vs transitive
  • direct: the libraries you added to your project
  • transitive: what those depend on, levels deep
  • a few direct deps can pull in hundreds
  • most vulns are in transitive deps you never chose
  • the lockfile records the exact resolved versions

How SCA works

SCA works by matching. It reads your lockfile to get every package and its exact version, then matches those against advisory databases: the national database, GitHub Advisories, the open-source OSV database and vendor feeds. For each match it reports the package, version, vulnerability, severity and fixed version. The best tools also show the dependency path, so you see which direct dependency pulled in a vulnerable transitive one, which is what you need to fix it.

The mechanism
  • read the lockfile: every package and exact version
  • match against advisory DBs (NVD, GitHub, OSV, vendor)
  • report: package, version, CVE, severity, fixed version
  • best tools show the dependency path to a transitive vuln
  • flag outdated, end-of-life packages

The tools

There are several good tools. Trivy and Grype are fast, free and scan both source projects and images. OWASP Dependency-Check is free and long-established. Snyk is a popular commercial option with strong fix advice. GitHub's Dependabot alerts are built into repositories. And every ecosystem has a native scanner: npm audit, pip-audit, cargo audit, govulncheck. Most teams run one scanner in the pipeline and rely on ecosystem tools locally. They all draw on the same advisory data.

SCA tools
  • Trivy, Grype: fast, free, scan code and images
  • OWASP Dependency-Check: free, long-established
  • Snyk: commercial, strong fix advice and developer UX
  • GitHub Dependabot alerts: built into GitHub repos
  • language-native: npm audit, pip-audit, cargo audit, govulncheck

Not all alerts matter

A long list of dependency alerts is not a long list of real risks. A vulnerability in a package you include but never call may be no risk at all. Some SCA tools do reachability analysis: they check whether your code actually reaches the vulnerable function, which cuts the noise. Even so, you prioritise by context, exposure, the exploit-prediction score and the known-exploited list, as in Part five. The next episode is entirely about triaging these alerts, because the volume is the real challenge.

Reachability and context
  • a CVE in a package you include but never call is low risk
  • reachability analysis: does your code actually reach the vulnerable function?
  • cuts the noise dramatically
  • still: context (exposure, EPSS, KEV) decides priority
  • next episode is all about triaging these alerts

More than CVEs

SCA does more than find known vulnerabilities. It checks licenses, flagging copyleft or incompatible ones before they become a legal problem. It can catch malicious packages: typosquats, hijacked packages and suspicious install scripts, which episode seven covers. And it flags abandoned dependencies. Mature teams write policy on all of this: block a package not just for a vulnerability, but for a bad license, extreme age, or no maintenance.

Beyond vulnerabilities
  • license compliance: flag copyleft or incompatible licenses before legal does
  • malicious packages: typo- squats, hijacks, install scripts
  • abandoned / unmaintained deps
  • policy: block on license, age or no maintenance, not just CVEs

Running it well

Run SCA on every build, against the lockfile, and fail only on new critical issues in dependencies your code actually reaches, warning on the rest. The subtle point is to rescan continuously, not just at build time: a dependency clean yesterday can have a new vulnerability disclosed today, and you want to know across your estate the same day. Keep an inventory of what you depend on, the software bill of materials in episode five, and pair SCA with automated update tools, in episode four.

In practice
  • scan every build, against the lockfile
  • fail on NEW criticals in reachable deps; warn on rest
  • rescan continuously: a dep clean yesterday may have a CVE today
  • keep a dependency inventory (the SBOM, ep 5)
  • pair with auto-update tools (ep 4)

Common mistakes

Mistakes. Scanning only direct dependencies and ignoring transitive ones, where most of the risk is. Treating every reported vulnerability as urgent with no context, which buries the few that matter. Scanning once at build time and never re-scanning, so a newly disclosed critical goes unnoticed. Ignoring license and malicious-package risk, which SCA can catch. Updating dependencies blindly and breaking the build, the thing that makes teams stop updating. And having no inventory of what you actually depend on.

Avoid these
  • scanning direct deps only, ignoring transitive
  • treating every CVE as urgent with no context
  • scanning once, never re-scanning
  • ignoring license and malicious-package risk
  • updating blindly and breaking the build
  • no dependency inventory

Say it like this

In the interview: I run software composition analysis against the lockfile, so it covers transitive dependencies where most risk lives, matching exact versions against OSV, GitHub Advisories and vendor feeds. I prioritise with reachability analysis and context like exposure and the known-exploited list, not treating every vulnerability as urgent. I block new criticals in reachable deps, rescan continuously, check licenses and malicious packages, and pair it with automated updates and an SBOM.

In the interview
  • "SCA against the lockfile, covering transitive deps where
  • most risk is, matched to OSV
  • and vendor advisories. I use
  • reachability and context to prioritise, block new criticals in reachable deps, rescan continuously, check
  • licenses and malicious
  • packages, and automate updates."

Interview questions

Q1What is software composition analysis (SCA)?

Automated analysis that identifies the open-source and third-party components in an application and checks them against known vulnerability, license and malicious-package data. It typically reads lockfiles or manifests to determine exact versions and matches them to advisories.

Q2What is the difference between a direct and a transitive dependency?

A direct dependency is one your project explicitly declares. A transitive dependency is one pulled in indirectly by your direct dependencies. Most components, and most vulnerabilities, are transitive, which is why scanning only direct dependencies misses most risk.

Q3Why scan the lockfile rather than the manifest?

The manifest may specify version ranges, while the lockfile records the exact resolved versions of every direct and transitive dependency that is actually installed. Scanning the lockfile reflects what you really ship.

Q4What SCA tools are commonly used?

Trivy and Grype (fast, free, scan code and images), OWASP Dependency-Check, commercial tools like Snyk, GitHub Dependabot alerts, and ecosystem-native scanners such as npm audit, pip-audit, cargo audit and govulncheck. Most draw on shared advisory databases.

Q5What is reachability analysis in SCA?

An analysis that determines whether the application actually calls the vulnerable code path in a dependency. If the vulnerable function is never reached, the risk is low, so reachability greatly reduces noise and improves prioritisation.

Q6Can SCA detect more than known vulnerabilities?

Yes. It can flag incompatible or risky open-source licenses, detect malicious packages such as typosquats and hijacked packages with suspicious install scripts, and identify abandoned or unmaintained dependencies, all of which can be subject to policy.

Q7Why must dependency scanning be continuous?

Because new vulnerabilities are disclosed daily. A dependency that passed yesterday may have a critical advisory today, so re-scanning the existing estate, not just scanning at build time, is needed to detect newly disclosed issues promptly.

Q8How should SCA results be gated in a pipeline?

Typically by failing the build on new critical vulnerabilities in reachable dependencies and warning on the rest, with prioritisation by exposure, EPSS and known-exploited status, so developers address real risk without being overwhelmed by every alert.