Dependency review and vulnerability audits
Quick answer
Dependency review combines provenance, maintenance, permissions and known-vulnerability information. npm audit checks a dependency tree against advisory information from a registry that supports the audit API.
Tooling examples
Example 1. Context: projects/npm-lab. Run in a fresh prepared fixture copy; see its README. Local check available; consult validation evidence for what was asserted.
npm ls @lesson/units --all --jsonExpected observation: The local units dependency appears in the reported tree.
Example 2. Context: projects/npm-lab. Run in a fresh prepared fixture copy; see its README. Requires an approved networked registry; not tested here. Manual integration example — not executed here.
npm audit --jsonExpected observation: A registry-dependent advisory report or a clear failure; no fixed count is guaranteed.
How the tooling works
Inspect new packages, lockfile changes, install hooks, direct and transitive paths. npm ls can help locate a dependency. npm audit may require network access and a compatible registry; findings vary over time. Review the affected version, reachability and remediation, then test deliberate upgrades. An empty report is not evidence of absence of malicious code or all vulnerabilities. Audit fix may change dependency versions; forcing breaking upgrades without review is unsafe. Never send secrets or private artifacts to an unapproved scanner.
Common mistakes
Do not claim an audit passed if it could not contact the registry. Audit data is only one signal.
Practice
Trace a local dependency with npm ls. In an approved networked environment, examine an audit report and identify the affected dependency path without applying automatic fixes.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Dependency review and vulnerability audits — Knowledge Check
Assess tooling contracts, diagnostic reasoning and transfer to a project.
What is an npm audit report based on?
What should you do before forcing an upgrade that may break compatibility?
If audit cannot reach the registry, how should the result be recorded?
In Dependency review and vulnerability audits, what is the expected observation for example 1 in its documented setup? npm ls @lesson/units --all --json
In Dependency review and vulnerability audits, what is the expected observation for example 2 in its documented setup? npm audit --json