VulnCheck.Entrypoints.Adapters (VulnCheck v1.0.1)

Copy Markdown View Source

Resolves which implementation of a pluggable adapter family is configured (Tesla, Swoosh, Ecto, Phoenix.PubSub), so a vulnerable adapter package that is merely a transitive dependency can be told apart from the active one.

Sources, all read without executing code: config/config.exs, config/<env>.exs, config/runtime.exs (quoted with atom-safe encoding), the configured_adapters option and module literals of the project's own compiled code (adapter Tesla.Adapter.Mint, use Ecto.Repo, adapter: ...).

Summary

Functions

Known adapter families.

Reads the configuration files of the project. Returns every module alias mentioned in them with the file (relative to the project) and line where it appears, whether an adapter key had a non-literal value, and notes about unreadable files.

Resolves configured adapters and inactive adapter packages.

Types

result()

@type result() :: %{
  configured: %{required(atom()) => [String.t()]},
  inactive: %{required(String.t()) => String.t()},
  config_refs: [String.t()],
  config_sites: %{required(String.t()) => {String.t(), non_neg_integer() | nil}},
  notes: [String.t()]
}

Functions

families()

@spec families() :: map()

Known adapter families.

read_config_files(workspace)

@spec read_config_files(VulnCheck.Types.Workspace.t()) ::
  {[{String.t(), String.t(), non_neg_integer() | nil}], boolean(), [String.t()]}

Reads the configuration files of the project. Returns every module alias mentioned in them with the file (relative to the project) and line where it appears, whether an adapter key had a non-literal value, and notes about unreadable files.

resolve(workspace, modules, config)

@spec resolve(
  VulnCheck.Types.Workspace.t(),
  %{required(String.t()) => VulnCheck.Types.ModuleSummary.t()},
  VulnCheck.Config.t() | nil
) :: result()

Resolves configured adapters and inactive adapter packages.