IntermediateLesson 5 of 10

Dependency Scanning

Identify vulnerable direct and transitive dependencies and remediate safely with version upgrades.

Simple Explanation (ELI5)

Your app uses many libraries. If one library has a known vulnerability, your app inherits that risk.

Technical Explanation

Dependency scanning maps lockfiles/manifests to known vulnerability databases. GitHub Dependabot alerts report CVEs, affected ranges, and fixed versions. Prioritization should combine CVSS, exploit availability, and runtime exposure.

Visual Section

package.json
→
Lockfile graph
→
CVE match
→
Alert + PR

Hands-on Commands

yaml
version: 2
updates:
  - package-ecosystem: "npm"
    directory: "/"
    schedule:
      interval: "daily"
    open-pull-requests-limit: 10
    labels:
      - "security"
      - "dependencies"
bash
# local dependency audit (example)
npm audit --production

# update vulnerable dependency
npm install lodash@latest
npm test

Debugging Scenarios

Real-world Use Case

A high-severity vulnerability in a popular logging package was auto-detected. Dependabot PR shipped same day, avoiding exposure during active internet exploitation.

Interview Questions

Beginner

What is dependency scanning?▾

Checking dependencies against known vulnerability databases.

What is Dependabot?▾

GitHub tool that alerts and proposes update PRs for dependencies.

Direct vs transitive dependency?▾

Direct is declared by you; transitive is pulled by another package.

Why commit lockfiles?▾

To ensure reproducible builds and accurate vulnerability matching.

What is a CVE?▾

A public identifier for a known security vulnerability.

Intermediate

How prioritize dependency alerts?▾

Severity + exploitability + internet exposure + business criticality.

What if upgrade is breaking?▾

Use nearest patched minor/patch and plan major migration.

How prevent dependency drift?▾

Regular automated updates with scheduled windows.

How secure private registries?▾

Use authenticated feeds and mirror trusted sources.

What is dependency confusion?▾

Attack using public package with same name as internal package.

Scenario-based

Critical CVE in auth library before release.▾

Block release, patch dependency, rerun regression/security tests.

Dependabot PR flood overwhelms team.▾

Group updates and cap concurrent PRs by ecosystem.

Transitive vuln has no patch yet.▾

Compensating controls, monitor exploit status, and track upstream issue.

Security fix increases latency.▾

Benchmark alternatives and select secure+performant version with data.

How prove remediation to auditors?▾

Provide alert closure evidence, PR hash, and deployed version tags.

Summary

Dependency scanning catches known ecosystem risk quickly, but secure remediation requires careful upgrade strategy and testing discipline.