Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Confidence Scoring

Not all imports are equally reliable. ghostdep assigns a confidence level to each finding based on how the import was detected.

Levels

ConfidenceWhat it meansExamples
highStatic import at top levelimport x, use x, require("x"), from x import y
mediumConditional or dynamic with string literaltry: import x, import("lodash")
lowDynamic with variable/expressionrequire(expr), importlib.import_module(var), import(getModule())

Language-specific behavior

  • Go — all imports are high confidence (Go has no dynamic imports)
  • Rust — all imports are high confidence (no dynamic imports)
  • Java — all imports are high confidence (Class.forName() not detected in v1)
  • JavaScript/TypeScript — mixed: ESM imports and require("string") are high, import("string") is medium, require(variable) is low
  • Python — mixed: import x and from x import y are high, imports inside try/except are medium, __import__() and importlib.import_module() are low

Filtering

Show only high-confidence findings:

ghostdep --min-confidence high

Show medium and above:

ghostdep --min-confidence medium

Default is low (show everything).

In config

min_confidence: medium

In output

Text format shows confidence inline:

[phantom] axios at src/api.js:3 (confidence: high)

JSON and SARIF include it as a field/property on each finding.