Home / Docs / DIRT Algorithm

DIRT Algorithm

DIRT (Dependency Intelligence Risk Tracker) assesses business and security risk based on package metadata, maintainer activity, and historical patterns.

Overview

While RUNT focuses on typosquatting, DIRT evaluates the overall trustworthiness of a package by analyzing multiple risk signals. Even a legitimately-named package can be dangerous if it’s unmaintained, has suspicious metadata, or exhibits risky patterns.

πŸ’‘ Why DIRT Matters

70% of supply chain attacks exploit legitimate but vulnerable packages, not typosquats. DIRT catches these by evaluating package health and maintainer reputation.

Risk Signals

DIRT analyzes these signals to calculate a risk score:

SignalWeightRisk Indicator
πŸ“… Package Age15%New packages (<30 days) are higher risk
πŸ“Š Download Trends15%Sudden spikes or drops indicate anomalies
πŸ‘€ Maintainer Activity20%Inactive maintainers = unpatched vulnerabilities
πŸ”— Dependency Count10%Excessive dependencies increase attack surface
πŸ›‘οΈ Known CVEs25%Existing vulnerabilities in NVD/OSV databases
πŸ“œ License Type10%Missing or unusual licenses are suspicious
πŸ“ README/Docs5%Missing documentation indicates low quality

Risk Levels

DIRT outputs one of four risk levels:

βœ… LOW (0.0 – 0.3)

Package appears healthy. Well-maintained, no known vulnerabilities, normal activity patterns.

Action: Safe to use

⚠️ MEDIUM (0.3 – 0.6)

Some concerns detected. May have minor issues like infrequent updates or minimal documentation.

Action: Review before using

πŸ”΄ HIGH (0.6 – 0.8)

Significant risks identified. Possibly unmaintained, known vulnerabilities, or suspicious patterns.

Action: Avoid or find alternative

🚨 CRITICAL (0.8 – 1.0)

Severe risks. Known malicious package, critical unpatched CVEs, or confirmed compromised maintainer.

Action: Do not use

Asset Criticality Multiplier

DIRT adjusts risk scores based on where the package will be deployed:

CriticalityMultiplierUse Case
PUBLIC0.5xPublic-facing, non-sensitive (marketing sites, demos)
INTERNAL1.0xInternal tools, development environments
CRITICAL2.0xProduction systems, customer data, financial
# Set criticality for scan
falcn scan . --asset-criticality CRITICAL

# In config.yaml
detection:
  dirt:
    asset_criticality: CRITICAL

⚠️ Production Deployments

Always use CRITICAL for production systems. A MEDIUM risk package becomes HIGH when deployed to critical infrastructure.

Example Output

Healthy Package

πŸ“¦ Package: lodash@4.17.21
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

DIRT Risk Assessment: LOW (0.12)

Signals:
  βœ… Package Age:        4,380 days (established)
  βœ… Weekly Downloads:   45M (very popular)
  βœ… Last Update:        32 days ago (active)
  βœ… Dependencies:       0 (minimal surface)
  βœ… Known CVEs:         0 (clean)
  βœ… License:            MIT (permissive)

Recommendation: Safe to use

Risky Package

πŸ“¦ Package: sketchy-utils@0.1.0
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

DIRT Risk Assessment: HIGH (0.73)

Signals:
  ⚠️ Package Age:        12 days (very new)
  ⚠️ Weekly Downloads:   47 (low adoption)
  ❌ Last Update:        12 days ago (single release)
  ⚠️ Dependencies:       23 (high count)
  ❌ Known CVEs:         2 (unpatched)
  ❌ License:            UNLICENSED (missing)

Risk Factors:
  β€’ New package with no track record
  β€’ Excessive dependencies for stated purpose
  β€’ Known vulnerabilities not addressed
  β€’ No license specified

Recommendation: Avoid - find established alternative

Configuration

# config.yaml
detection:
  dirt:
    enabled: true

    # Risk thresholds
    thresholds:
      low: 0.3
      medium: 0.6
      high: 0.8

    # Asset criticality (PUBLIC, INTERNAL, CRITICAL)
    asset_criticality: INTERNAL

    # Signal weights (must sum to 1.0)
    weights:
      package_age: 0.15
      download_trends: 0.15
      maintainer_activity: 0.20
      dependency_count: 0.10
      known_cves: 0.25
      license: 0.10
      documentation: 0.05

    # CVE severity mapping
    cve_weights:
      critical: 1.0
      high: 0.7
      medium: 0.4
      low: 0.1

CLI Options

# Run DIRT analysis only
falcn scan . --algorithms dirt

# Set asset criticality
falcn scan . --asset-criticality CRITICAL

# Fail if HIGH or CRITICAL risk found
falcn scan . --fail-on high

# Include CVE details in output
falcn scan . --check-vulnerabilities

# Show all signals (not just flagged)
falcn scan . --verbose

Data Sources

DIRT pulls data from multiple sources:

SourceData ProvidedUpdate Frequency
npm RegistryPackage metadata, downloads, maintainersReal-time
PyPI APIPackage info, release historyReal-time
OSV DatabaseOpen source vulnerabilitiesHourly
NVD (NIST)CVE details and severityDaily
GitHub APIMaintainer activity, repo healthReal-time

Handling False Positives

Some legitimate packages may trigger DIRT warnings:

  • New but legitimate packages β€” Low download count initially
  • Stable packages β€” May appear “unmaintained” if no updates needed
  • Internal packages β€” Won’t have public download stats

Allowlisting

# config.yaml
detection:
  dirt:
    allowlist:
      - "@mycompany/*"      # Internal packages
      - "stable-lib"        # Known stable package
      - "legacy-tool@1.2.3" # Specific version

Combining with RUNT

DIRT and RUNT work together for comprehensive protection:

ScenarioRUNTDIRTResult
Typosquat of popular packageπŸ”΄ HIGHπŸ”΄ HIGH (new, low downloads)CRITICAL
Legitimate but vulnerableβœ… PASSπŸ”΄ HIGH (CVEs)HIGH
Healthy popular packageβœ… PASSβœ… LOWSAFE
Similar name, healthy package⚠️ MEDIUMβœ… LOWREVIEW

πŸ›‘οΈ Defense in Depth

Running both RUNT and DIRT provides layered protection. RUNT catches naming attacks while DIRT evaluates package health.

Related Documentation

πŸ” RUNT Algorithm Typosquatting detection using string similarity. πŸ•ΈοΈ GTR Algorithm Dependency graph analysis for suspicious patterns. βš–οΈ Policy Engine Configure BLOCK/ALERT/REVIEW thresholds.