VulnCheck.Workspace (VulnCheck v1.0.1)

Copy Markdown View Source

Stage 1 of the pipeline: loads the project under audit into a VulnCheck.Types.Workspace.

It detects the project type, parses the lockfile without evaluating code, computes the production dependency closure (packages reachable only from :dev/:test dependencies become :non_prod, packages reachable only from runtime: false dependencies become :build_only) and locates compiled ebin directories, falling back from the requested build environment to the other available ones.

Summary

Functions

Assigns :prod / :build_only / :non_prod scopes. Packages reachable from production roots are :prod; packages reachable otherwise only from build-time roots (runtime: false dependencies of the production closure) are :build_only; packages reachable only from non-production roots are :non_prod; packages reachable from none stay :prod (fail-safe).

Computes the set of package names reachable from roots through deps.

Loads the workspace described by config.

Functions

assign_scopes(packages, prod_roots, non_prod_roots, build_roots \\ [])

@spec assign_scopes(
  %{required(String.t()) => VulnCheck.Types.Package.t()},
  [String.t()],
  [String.t()],
  [String.t()]
) :: %{required(String.t()) => VulnCheck.Types.Package.t()}

Assigns :prod / :build_only / :non_prod scopes. Packages reachable from production roots are :prod; packages reachable otherwise only from build-time roots (runtime: false dependencies of the production closure) are :build_only; packages reachable only from non-production roots are :non_prod; packages reachable from none stay :prod (fail-safe).

closure(packages, roots)

@spec closure(%{required(String.t()) => VulnCheck.Types.Package.t()}, [String.t()]) ::
  MapSet.t(String.t())

Computes the set of package names reachable from roots through deps.

load(config)

@spec load(VulnCheck.Config.t()) ::
  {:ok, VulnCheck.Types.Workspace.t()} | {:error, term()}

Loads the workspace described by config.