VulnCheck.Workspace.MixLock (VulnCheck v1.0.1)

Copy Markdown View Source

Atom-safe parser for mix.lock.

The lockfile is read with VulnCheck.Literal (never evaluated) and every supported entry format is normalized into a VulnCheck.Types.Package:

  • Hex 8-tuples: {:hex, :pkg, "1.2.3", inner, managers, deps, "hexpm", outer}
  • legacy Hex 7-, 6-, 5- and 4-tuples
  • Git dependencies: {:git, url, sha, opts}

Optional sub-dependencies are only linked when the optional package itself is present in the lockfile, matching how Mix resolves them.

Summary

Functions

Parses mix.lock content into a map of app_name => Package (scope :prod until the workspace loader computes the real closure).

Reads and parses a mix.lock file.

Reads and parses mix.lock, also returning unsupported-entry warnings.

Like parse/2, returning {:ok, packages, warnings} where warnings lists any unsupported lockfile entries.

Functions

parse(content, opts \\ [])

@spec parse(String.t(), keyword()) ::
  {:ok, %{required(String.t()) => VulnCheck.Types.Package.t()}}
  | {:error, String.t()}

Parses mix.lock content into a map of app_name => Package (scope :prod until the workspace loader computes the real closure).

parse_file(path)

@spec parse_file(Path.t()) ::
  {:ok, %{required(String.t()) => VulnCheck.Types.Package.t()}}
  | {:error, String.t()}

Reads and parses a mix.lock file.

parse_file_with_warnings(path)

@spec parse_file_with_warnings(Path.t()) ::
  {:ok, %{required(String.t()) => VulnCheck.Types.Package.t()}, [String.t()]}
  | {:error, String.t()}

Reads and parses mix.lock, also returning unsupported-entry warnings.

parse_with_warnings(content, opts \\ [])

@spec parse_with_warnings(String.t(), keyword()) ::
  {:ok, %{required(String.t()) => VulnCheck.Types.Package.t()}, [String.t()]}
  | {:error, String.t()}

Like parse/2, returning {:ok, packages, warnings} where warnings lists any unsupported lockfile entries.