VulnCheck.Solver (VulnCheck v1.0.1)

Copy Markdown View Source

Classifies every matched advisory as :reachable, :potentially_reachable, :unreachable or :retired (see docs/REACHABILITY_MODEL.md).

Protocol clients (mint, gun, finch) receive data on the connections the project opens: once a function of a client package is reachable, the traversal continues from the client's receive functions, and their chains continue the chain that reaches the client.

Breadth-first traversal from the entrypoints computes the reachable functions and a parent edge for each of them, so the shortest witness trace of any reachable function is rebuilt in time proportional to its length. The traversal first visits everything reachable from the project's own entrypoints and only then continues from the protocol handlers of network daemons, so a function is attributed to a daemon only when no proven chain reaches it. Chains from a root the project does not call itself start with the root's activation hop. A separate traversal excludes speculative edges when they occur in the graph.

Routines and modules of the advisory that belong to other packages or to Erlang/OTP and Elixir are context only (VulnCheck.Solver.RoutineScope).

Decision order for an advisory of package pkg:

  1. retired release → :retired
  2. pkg outside the production closure (development, test or build-time only) → :non_prod_dependency
  3. runtime OTP release outside the affected range → :otp_version_unaffected
  4. an affected routine is reachable → :reachable with a trace (:daemon_call_chain when the chain starts at a daemon's protocol handler); an affected module is reachable without routine data → potentially
  5. unused adapter / application not started, with nothing of pkg reachable → :adapter_not_configured / :otp_app_not_started
  6. soundness boundaries → :missing_beam_debug_info, :active_network_daemon, :unresolved_dynamic_dispatch, :missing_symbol_granularity
  7. proven absence → :module_not_loaded / :function_not_called

Summary

Functions

Classifies one advisory against a prepared index.

One warning per dynamic call site that keeps active findings potentially reachable, naming the affected packages, so that a single unresolved apply/3 widening many advisories is visible.

Builds the reachability index once for a workspace.

Classifies advisories and returns findings in report order.

Sorts findings: verdict, severity (most severe first), package, advisory id.

Functions

classify(advisory, index)

@spec classify(VulnCheck.Types.Advisory.t(), %VulnCheck.Solver.Index{
  activations: term(),
  app_by_package: term(),
  artifact_issues: term(),
  atom_modules: term(),
  atoms_constructed: term(),
  client_anchors: term(),
  config: term(),
  escapes: term(),
  graph: term(),
  model: term(),
  modules_by_package: term(),
  named_modules: term(),
  parents: term(),
  proven_client_anchors: term(),
  proven_parents: term(),
  reachable: term(),
  reachable_modules: term(),
  reachable_packages: term(),
  started: term(),
  workspace: term()
}) :: VulnCheck.Types.Finding.t()

Classifies one advisory against a prepared index.

dynamic_dispatch_warnings(findings)

@spec dynamic_dispatch_warnings([VulnCheck.Types.Finding.t()]) :: [String.t()]

One warning per dynamic call site that keeps active findings potentially reachable, naming the affected packages, so that a single unresolved apply/3 widening many advisories is visible.

index(workspace, graph, model, config)

@spec index(
  VulnCheck.Types.Workspace.t(),
  VulnCheck.Beam.CallGraph.t(),
  VulnCheck.Types.EntrypointModel.t(),
  VulnCheck.Config.t()
) :: %VulnCheck.Solver.Index{
  activations: term(),
  app_by_package: term(),
  artifact_issues: term(),
  atom_modules: term(),
  atoms_constructed: term(),
  client_anchors: term(),
  config: term(),
  escapes: term(),
  graph: term(),
  model: term(),
  modules_by_package: term(),
  named_modules: term(),
  parents: term(),
  proven_client_anchors: term(),
  proven_parents: term(),
  reachable: term(),
  reachable_modules: term(),
  reachable_packages: term(),
  started: term(),
  workspace: term()
}

Builds the reachability index once for a workspace.

solve(workspace, graph, model, advisories, config)

Classifies advisories and returns findings in report order.

sort(findings)

Sorts findings: verdict, severity (most severe first), package, advisory id.