VulnCheck.Diff (VulnCheck v1.0.1)

Copy Markdown View Source

Incremental reporting for pull requests.

  • Baselines (--baseline report.json): findings whose fingerprint is in a previous JSON report are hidden. Fingerprints include the verdict, so an advisory that moves from unreachable to reachable is new, and the escalation is reported.
  • Git diffs (--diff <ref>): keep findings tied to changed packages or files. Keep every actionable finding unless a baseline establishes that it was already known. A current witness alone cannot establish the verdict at the base revision.

Both fail open: when the baseline or the Git data cannot be read, every finding is kept and a warning explains why.

Summary

Functions

Hides findings present in the baseline. Returns the remaining findings and warnings (escalations, number of hidden findings).

Serializable baseline document of a report.

Scanner post-processing step for --baseline.

Packages added or whose locked identity changed since ref.

Scanner post-processing step for --diff <ref>.

Stable identity of a locked package for baseline comparisons.

Reads a baseline or a full JSON report. Entries without enough evidence to compare the version, severity and policy state cannot hide a finding.

Writes the baseline of a report to path.

Functions

apply_baseline(findings, entries, workspace \\ nil)

@spec apply_baseline(
  [VulnCheck.Types.Finding.t()],
  [map()],
  VulnCheck.Types.Workspace.t() | nil
) ::
  {[VulnCheck.Types.Finding.t()], [String.t()]}

Hides findings present in the baseline. Returns the remaining findings and warnings (escalations, number of hidden findings).

baseline_document(report)

@spec baseline_document(VulnCheck.Types.ScanReport.t()) :: map()

Serializable baseline document of a report.

baseline_step(path)

@spec baseline_step(Path.t()) :: (list(), map() ->
                              {list(), [String.t()], [String.t()]})

Scanner post-processing step for --baseline.

changed_packages(workspace, root, ref)

@spec changed_packages(VulnCheck.Types.Workspace.t(), String.t(), String.t()) ::
  {:ok, MapSet.t(String.t())} | {:error, term()}

Packages added or whose locked identity changed since ref.

diff_step(ref)

@spec diff_step(String.t()) :: (list(), map() -> {list(), [String.t()], [String.t()]})

Scanner post-processing step for --diff <ref>.

package_identity(arg1, name)

@spec package_identity(VulnCheck.Types.Workspace.t() | nil, String.t()) ::
  String.t() | nil

Stable identity of a locked package for baseline comparisons.

read_baseline(path)

@spec read_baseline(Path.t()) :: {:ok, [map()]} | {:error, String.t()}

Reads a baseline or a full JSON report. Entries without enough evidence to compare the version, severity and policy state cannot hide a finding.

write_baseline(report, path)

@spec write_baseline(VulnCheck.Types.ScanReport.t(), Path.t()) ::
  :ok | {:error, term()}

Writes the baseline of a report to path.