AI Hints
CI/CD with GitHub Actions · Lesson 67 of 138

Dependency Scanning

Known vulnerabilities.

⏱ 2 min read▶ Video at 1:16:56🎓 Free
Watch this lesson in the CI/CD with GitHub Actions courseWatch on YouTube ↗Full CI/CD with GitHub Actions course

Your code might be perfect, but the libraries it uses can have security holes. New problems are found every day, and published in public databases. Dependency scanning checks your libraries against those databases, on every change.

Dependency Scanning
From the video: Dependency Scanning
  • Libraries have holes too
  • Published every day
  • Scan on every change

Scanning in a workflow

For Python, pip audit checks the installed packages against a database of known vulnerabilities, and fails if it finds any. For JavaScript, NPM audit does the same. And on pull requests, GitHub's dependency review action warns when a change adds a vulnerable package.

audit.ymlyaml
jobs:
  audit:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: pip install -q pip-audit -r requirements.txt
      - run: pip-audit
      - uses: actions/dependency-review-action@v4
        if: github.event_name == 'pull_request'

What to do with a finding

When a scan finds a problem, read the report. It names the package, the problem, and usually the version that fixes it. Update to that version, run the tests, and merge. If there's no fix yet, decide whether your code actually uses the risky feature, and record that decision.

keyvalue
Packagewhich library
Advisorywhat the hole is
Fixed inthe safe version
Update + testthen merge

Summary

Dependency scanning checks your libraries for known security problems, with tools like pip audit and NPM audit. Next, keeping dependencies up to date automatically.

Key takeaways
  • pip-audit
  • npm audit
  • dependency-review-action
Next up: Dependabot — automatic updates