Dependency Security

Purpose

Modern applications depend on hundreds of third-party packages.

Each dependency introduces potential security risks: known vulnerabilities, malicious code, license compliance issues and maintenance abandonment.

This guide covers the practices for managing dependency security throughout the application lifecycle.

Vulnerability Scanning

Automated Scanning

Every project MUST scan dependencies for known vulnerabilities.

EcosystemToolCI Integration
Rubybundler-auditbundle exec bundler-audit check --update
JavaScriptnpm audit / yarn auditnpm audit --audit-levelhigh=
Pythonpip-auditpip-audit
DockerTrivy / Grypetrivy image myapp:latest

Continuous Monitoring

Use a service that monitors dependencies continuously:

These services automatically create pull requests when vulnerabilities are detected.

Dependency Selection

Evaluation Criteria

Before adding a new dependency, evaluate:

CriterionQuestions
NecessityCan we solve this without a dependency?
MaintenanceWhen was the last release? Is it actively
maintained?
Security trackAre there historical vulnerabilities? How quickly
recordare they addressed?
CommunityHow many users? Is there a community around it?
LicenseIs the license compatible with our project?
Size and complexityIs it a small focused library or a large framework?

Minimum Dependency Principle

Prefer standard library or framework built-in features over external dependencies.

For each dependency in the project, periodically ask: is this still needed?

Vulnerability Response

Severity Classification

SeverityDefinitionResponse Time
CriticalRemote code execution, authentication bypass,Within 24 hours
data breach.
HighSignificant data exposure, privilegeWithin 1 week
escalation.
MediumLimited information disclosure,Within 1 month
minor privilege escalation.
LowMinimal risk, difficult to exploit.Next release.

Response Workflow

  1. Verify the vulnerability affects our usage.
  2. Determine if a patched version is available.
  3. Update the dependency.
  4. Run tests to verify compatibility.
  5. Deploy the fix.

If no patch is available:

License Compliance

Approved Licenses

Maintain a list of approved licenses:

Restricted Licenses

Restricted licenses require legal review:

Tooling

Use license_finder or similar tools to enforce license policies in CI.

Dependency Hygiene

Regular Audits

Removing Dependencies

When removing a dependency:

Related Documents