Reference
Type Aliases
AuditArchive
type AuditArchive = object;Defined in: result.ts:829
The archive lookups the audit needs.
Type declaration
| Name | Type |
|---|---|
get | (depId) => | PackageReportData | undefined |
has | (depId) => boolean |
AuditFinding
type AuditFinding = object;Defined in: findings.ts:13
One reported alert. Every field is derived from the feed answer and checked: ids match their published formats, versions parse, text is scrubbed for terminal output.
Type declaration
| Name | Type | Description |
|---|---|---|
affects? | string | the affected version range, as the advisory states it |
aiFlagged? | true | the feed found this by AI analysis rather than a published report |
alternatePackage? | string | for typosquats, the package that was probably meant |
cve? | string | - |
cvss? | number | - |
cwes? | string[] | - |
exploited? | true | listed in CISA's Known Exploited Vulnerabilities catalog |
ghsa? | string | - |
kind | FindingKind | - |
patched? | string | the first version the advisory says is not affected |
severity | SeverityLevel | - |
title? | string | - |
url? | string | - |
AuditGraphOptions
type AuditGraphOptions = PackageInfoClientOptions & object;Defined in: pipeline.ts:454
Type declaration
| Name | Type | Description |
|---|---|---|
auditLevel | AuditLevel | the lowest severity that fails the audit |
graph | Graph | the graph the audited packages are in |
importers | Node[] | the audited importers: the project, or the selected workspaces |
nodes | ReadonlySet<Node> | the audited packages; importers among them are skipped |
remediation? | boolean | Look fixes up in the registry and the security feed, for the remediation lines. |
save-exact? | boolean | a fix saves its version with no save-prefix |
save-prefix? | string | what a fix saves before its version. Defaults to ^. |
signal | AbortSignal | - |
verbose? | (message) => void | called for diagnostics, e.g. an alert severity nobody knows |
warn | (message) => void | Called for warnings: security data that could not be read or came late, fixes that could not be looked up. |
within? | ReadonlySet<Node> | What a selection of workspaces reaches: the discovery query, the routes and the dependents stay inside it. Defaults to the whole graph. |
AuditLevel
type AuditLevel = SeverityLevel | "none";Defined in: alerts.ts:33
The --audit-level threshold: the lowest severity that makes the
command exit 1, or none to never fail on findings.
AuditPackage
type AuditPackage = object;Defined in: result.ts:771
Type declaration
| Name | Type | Description |
|---|---|---|
aliases? | string[] | the other names it is installed under, through npm: aliases |
direct | boolean | declared by one of the audited importers |
findings | AuditFinding[] | most severe first |
name | string | - |
path? | string | one route from an importer, for context |
pathCount | number | how many routes reach it |
pathCountTruncated | boolean | pathCount is a floor: counting stopped at its bound |
remediation? | string[] | What to do about it, one line each, when that can be said safely (human view) |
severity | SeverityLevel | the most severe of its findings |
version | string | - |
AuditProjectOptions
type AuditProjectOptions = ActualLoadOptions & Omit<AuditGraphOptions, "graph" | "importers" | "nodes" | "within"> & object;Defined in: pipeline.ts:582
Type declaration
| Name | Type | Description |
|---|---|---|
target? | string | Audit only the packages this DSS query selects; routes and remediation still go through the rest of the audited graph. It cannot use security selectors, and must select a package. |
workspace? | string[] | Audit only these workspaces and what they depend on, chosen as vlt query --workspace chooses them. |
workspace-group? | string[] | as workspace, for the workspaces in these groups |
AuditResult
type AuditResult = object;Defined in: result.ts:795
Type declaration
| Name | Type | Description |
|---|---|---|
auditLevel | AuditLevel | - |
bundled | string[] | audited packages that ship bundled dependencies |
directCount | number | - |
indirectCount | number | - |
noData | string[] | packages the feed should know and had no data for |
notAudited | string[] | packages that cannot be audited: not from the npm registry |
notAuditedRegistry? | string | A registry that is not the npm registry or registries.npm, and that packages a bare name led to came from: what registry or default-registry-alias pointed at when they were installed. A mirror the feed is not asked about, so the audit is incomplete. |
scannedCount | number | packages the feed had data for |
summary | Record<SeverityLevel, AuditPackage[]> | flagged packages by their most severe finding |
target? | string | the --target query that chose the audited packages |
total | number | how many packages have findings |
workspaces? | string[] | The selected workspaces, by path, when the audit covers only them and what they depend on (--workspace, --workspace-group, the directory it runs in, or vlt.json config) |
BuildAuditOptions
type BuildAuditOptions = object;Defined in: result.ts:837
Type declaration
| Name | Type | Description |
|---|---|---|
archive | AuditArchive | - |
auditLevel | AuditLevel | - |
flagged | Set<DepID> | the base ids of the packages the discovery query matched |
importers | Iterable<Node> | the audited importers: the project, or the selected workspaces |
nodes | Iterable<Node> | the audited packages; importers among them are skipped |
subgraph? | SubgraphOptions | Limits routes, path counts and dependents to the audited part of the graph, e.g. a selection of workspaces. Defaults to the whole graph. |
targets? | ReadonlyMap<DepID, FixTarget> | The checked version to recommend, by base dep id, from findFixTargets. Packages without one get no remediation. |
warn? | (message) => void | called for diagnostics, e.g. an alert severity nobody knows |
FindFixTargetsOptions
type FindFixTargetsOptions = object;Defined in: result.ts:212
Type declaration
| Name | Type | Description |
|---|---|---|
archive | AuditArchive | - |
flagged | Set<DepID> | the base ids of the packages the discovery query matched |
importers | Iterable<Node> | the audited importers: the project, or the selected workspaces |
lookup | FixLookup | - |
nodes | Iterable<Node> | the audited packages; importers among them are skipped |
savePrefix? | string | What vlt install saves before a version (save-prefix, or nothing with save-exact). Defaults to ^. |
subgraph? | SubgraphOptions | limits dependents to the audited part of the graph |
FindingKind
type FindingKind = "malware" | "vulnerability" | "possible-vulnerability" | "typosquat";Defined in: alerts.ts:59
What a reported finding is. Every other alert type the feed sends is
out of scope for vlt audit (it stays reachable through vlt query
selectors) and never affects a package's severity.
FixLookup
type FixLookup = object;Defined in: result.ts:184
What checking a fix needs from outside the graph. A lookup that fails, or answers undefined, means no fix is recommended.
Type declaration
| Name | Type | Description |
|---|---|---|
reports | (wanted) => Promise<( | PackageReportData | undefined)[]> | The security report of version of the package each node is a copy of, in order; undefined where there is none. |
resolve | (node, range) => Promise<string | undefined> | The version an install resolves range to, for the package node is a copy of: what vlt update moves a dependent to. |
versions | (node) => Promise<ReadonlyMap<string, boolean> | undefined> | The published versions of the package node is a copy of, each mapped to whether it is deprecated. |
FixTarget
type FixTarget = object;Defined in: result.ts:231
A checked version to recommend for a flagged package.
Type declaration
| Name | Type | Description |
|---|---|---|
range | string | What the fix: lines install for the importers that declare the package, and save: ${savePrefix}${version} when the version it resolves to was checked like version, else version itself. |
update? | Version[] | What vlt update installs once the fix: lines have run, when every dependent other than the importers that declare the package allows version and each of these versions was checked like it: for those dependents, and for FixTarget.range. |
updateOnly? | Version[] | What vlt update installs with no fix: line before it, the importers keeping the ranges they declare, when each of these versions was checked like version. |
version | Version | - |
SeverityLevel
type SeverityLevel = "critical" | "high" | "medium" | "low";Defined in: alerts.ts:11
Variables
auditQuery
const auditQuery: ":malware, :vuln(<=low), :severity(<=low), :squat" = ':malware, :vuln(<=low), :severity(<=low), :squat';Defined in: alerts.ts:8
The DSS query vlt audit finds flagged packages with. It selects
every alert type in alertKinds at any level; which of a
matched package's alerts are reported is then decided per alert.
severityOrder
const severityOrder: readonly SeverityLevel[];Defined in: alerts.ts:14
Severity levels, most severe first.
Functions
asAuditLevel()
function asAuditLevel(value): AuditLevelDefined in: alerts.ts:40
Map an --audit-level value onto an AuditLevel. npm spells
medium moderate and has an info level below low; the feed has no
informational grade, so info behaves as low.
Parameters
| Parameter | Type |
|---|---|
value | unknown |
Returns
auditFails()
function auditFails(result): booleanDefined in: result.ts:1089
Whether the audit fails: a finding at or above the audit level, or
an incomplete audit. none never fails.
Parameters
| Parameter | Type |
|---|---|
result | AuditResult |
Returns
boolean
auditGraph()
function auditGraph(options): Promise<AuditResult>Defined in: pipeline.ts:493
Audits packages of a loaded graph: reads their security data, runs
the discovery query, looks fixes up when remediation is set, and
builds the result.
Parameters
| Parameter | Type |
|---|---|
options | AuditGraphOptions |
Returns
Promise<AuditResult>
auditJSON()
function auditJSON(result): objectDefined in: result.ts:1104
The JSON view: the result without what only the human view shows
(remediation text, AI-flagged labels), with whether the audit is
auditIncomplete up front. Once released this shape is API,
so it only carries what was agreed on.
Parameters
| Parameter | Type |
|---|---|
result | AuditResult |
Returns
object
| Name | Type | Description |
|---|---|---|
auditLevel | AuditLevel | - |
bundled | string[] | audited packages that ship bundled dependencies |
directCount | number | - |
incomplete | boolean | - |
indirectCount | number | - |
noData | string[] | packages the feed should know and had no data for |
notAudited | string[] | packages that cannot be audited: not from the npm registry |
notAuditedRegistry? | string | A registry that is not the npm registry or registries.npm, and that packages a bare name led to came from: what registry or default-registry-alias pointed at when they were installed. A mirror the feed is not asked about, so the audit is incomplete. |
scannedCount | number | packages the feed had data for |
summary | Record<SeverityLevel, Omit<AuditPackage, "remediation" | "findings"> & object[]> | - |
target? | string | the --target query that chose the audited packages |
total | number | how many packages have findings |
workspaces? | string[] | The selected workspaces, by path, when the audit covers only them and what they depend on (--workspace, --workspace-group, the directory it runs in, or vlt.json config) |
auditProject()
function auditProject(options): Promise<AuditResult>Defined in: pipeline.ts:608
Audits the install in projectRoot as vlt audit does: refuses an
install vlt did not make or another client changed since, loads it
with every workspace, selects the importers and the target, then
runs auditGraph.
Parameters
| Parameter | Type |
|---|---|
options | AuditProjectOptions |
Returns
Promise<AuditResult>
buildAuditResult()
function buildAuditResult(__namedParameters): AuditResultDefined in: result.ts:939
Build the audit result: classify every package by what is known about it, then turn the alerts of the flagged ones into findings.
Packages are keyed by their base dep id, so one installed in several peer contexts is counted and reported once.
Parameters
| Parameter | Type |
|---|---|
__namedParameters | BuildAuditOptions |
Returns
findFixTargets()
function findFixTargets(__namedParameters): Promise<Map<DepID, FixTarget>>Defined in: result.ts:337
The version to recommend, by base dep id, for every flagged package whose findings a newer version can fix: vulnerabilities, with no malware or typosquat among them.
The candidate is the lowest published release at or above every
advisory's first patched version, outside every affected range, and
not deprecated. It is then looked up in the feed: when it has
vulnerabilities of its own the search goes on above them, at most
maxFixRounds candidates in all. A candidate with any other
finding, one the feed has no data for, or a lookup that fails ends
the search with no fix, so a recommended version is never one the
audit would flag.
What a fix: line saves is ${savePrefix}${version} when the
version that range resolves to is checked the same way, else the
version itself. When every other dependent allows the version, the
versions vlt update would move them to are checked the same way,
since they are usually newer than the one recommended; and when the
ranges already declared resolve to checked versions, vlt update
alone is the fix. With a selection of workspaces there is no
vlt update check: it would also move the unselected ones.
Parameters
| Parameter | Type |
|---|---|
__namedParameters | FindFixTargetsOptions |
Returns
Promise<Map<DepID, FixTarget>>
formatAuditSummary()
function formatAuditSummary(result, __namedParameters): stringDefined in: human-view.ts:235
The human view. Findings first and the summary last, so the counts are on screen when a long report ends; then what was audited and what was not, always.
Parameters
| Parameter | Type |
|---|---|
result | AuditResult |
__namedParameters | { colors: boolean; } |
__namedParameters.colors? | boolean |
Returns
string
incompleteReason()
function incompleteReason(result): undefined | stringDefined in: result.ts:1068
Why the audit is incomplete, when it is.
Parameters
| Parameter | Type |
|---|---|
result | AuditResult |
Returns
undefined | string
packageLabel()
function packageLabel(pkg): stringDefined in: result.ts:1132
name@version, and the alias names it is installed under
Parameters
| Parameter | Type |
|---|---|
pkg | AuditPackage |
Returns
string