v11y-check 0.15.6 → 0.15.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.readyup/kits/default.js +3 -3
- package/.readyup/manifest.json +4 -4
- package/dist/esm/bin/route.d.ts +5 -0
- package/dist/esm/cli.d.ts +20 -1
- package/dist/esm/cli.js +2 -2
- package/dist/esm/config.d.ts +10 -1
- package/dist/esm/format-actions.d.ts +6 -0
- package/dist/esm/format-check.d.ts +14 -0
- package/dist/esm/format-summary.d.ts +9 -0
- package/dist/esm/format-time.d.ts +9 -0
- package/dist/esm/format-verbose.d.ts +2 -1
- package/dist/esm/format-verbose.js +1 -1
- package/dist/esm/generate.d.ts +14 -0
- package/dist/esm/init/initCommand.d.ts +6 -0
- package/dist/esm/init/scaffold.d.ts +21 -1
- package/dist/esm/init/templates.d.ts +1 -0
- package/dist/esm/run-audit.d.ts +26 -0
- package/dist/esm/sync.d.ts +24 -0
- package/dist/esm/tmp.d.ts +8 -0
- package/dist/esm/types.d.ts +22 -0
- package/package.json +8 -8
package/.readyup/kits/default.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/** @noformat
|
|
1
|
+
/** @noformat -- @generated. Do not edit. Compiled by rdy. */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
-
export const __readyupVersion = "0.
|
|
3
|
+
export const __readyupVersion = "0.35.0";
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
// .readyup/kits/default.ts
|
|
@@ -63,7 +63,7 @@ var default_default = defineRdyKit({
|
|
|
63
63
|
]
|
|
64
64
|
});
|
|
65
65
|
function getMinVersion() {
|
|
66
|
-
const picked = { "version": "0.15.
|
|
66
|
+
const picked = { "version": "0.15.8" };
|
|
67
67
|
if (typeof picked["version"] !== "string") {
|
|
68
68
|
throw new TypeError("v11y-check/package.json: 'version' must be a string");
|
|
69
69
|
}
|
package/.readyup/manifest.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"checklists": [
|
|
6
6
|
"v11y-check"
|
|
7
7
|
],
|
|
8
|
-
"esbuildVersion": "0.28.
|
|
8
|
+
"esbuildVersion": "0.28.2",
|
|
9
9
|
"inputs": [
|
|
10
10
|
{
|
|
11
11
|
"hash": "52754bbb",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"path": "kits/default.ts"
|
|
14
14
|
},
|
|
15
15
|
{
|
|
16
|
-
"hash": "
|
|
16
|
+
"hash": "2c9cf983",
|
|
17
17
|
"kind": "inline",
|
|
18
18
|
"path": "../package.json",
|
|
19
19
|
"paths": [
|
|
@@ -23,10 +23,10 @@
|
|
|
23
23
|
],
|
|
24
24
|
"name": "default",
|
|
25
25
|
"path": "kits/default.js",
|
|
26
|
-
"readyupVersion": "0.
|
|
26
|
+
"readyupVersion": "0.35.0",
|
|
27
27
|
"source": "kits/default.ts",
|
|
28
28
|
"sourceHash": "52754bbb",
|
|
29
|
-
"targetHash": "
|
|
29
|
+
"targetHash": "6d9f65b0"
|
|
30
30
|
}
|
|
31
31
|
]
|
|
32
32
|
}
|
package/dist/esm/bin/route.d.ts
CHANGED
package/dist/esm/cli.d.ts
CHANGED
|
@@ -1,4 +1,23 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type CommandOptions } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Run the default audit command (CI mode).
|
|
4
|
+
*
|
|
5
|
+
* Generates config, invokes audit-ci for each scope, and returns a combined exit code.
|
|
6
|
+
*/
|
|
2
7
|
export declare function auditCommand(options: CommandOptions): Promise<number>;
|
|
8
|
+
/**
|
|
9
|
+
* Run the default grouped-check command.
|
|
10
|
+
*
|
|
11
|
+
* Audits each scope without allowlist filtering, cross-references results with
|
|
12
|
+
* the config allowlist, detects stale entries, and produces grouped output.
|
|
13
|
+
* Returns 1 when unallowed vulnerabilities exist.
|
|
14
|
+
*/
|
|
3
15
|
export declare function checkCommand(options: CommandOptions): Promise<number>;
|
|
16
|
+
/**
|
|
17
|
+
* Run the `sync` subcommand.
|
|
18
|
+
*
|
|
19
|
+
* Audits each scope in report mode without allowlist filtering, then updates
|
|
20
|
+
* the allowlist to match current findings. When no config file exists, creates
|
|
21
|
+
* one at the default path.
|
|
22
|
+
*/
|
|
4
23
|
export declare function syncCommand(options: CommandOptions): Promise<number>;
|
package/dist/esm/cli.js
CHANGED
|
@@ -2,14 +2,14 @@ import process from 'node:process';
|
|
|
2
2
|
import { reportError } from '@williamthorsen/nmr-core';
|
|
3
3
|
import { describeError } from '@williamthorsen/toolbelt.errors';
|
|
4
4
|
import { loadConfig } from "./config.js";
|
|
5
|
-
import { formatCheckJson, formatCheckText } from "./format-check.js";
|
|
5
|
+
import { formatCheckJson, formatCheckText, } from "./format-check.js";
|
|
6
6
|
import { formatCheckVerboseText } from "./format-verbose.js";
|
|
7
7
|
import { generateAuditCiConfig } from "./generate.js";
|
|
8
8
|
import { scaffoldConfig } from "./init/scaffold.js";
|
|
9
9
|
import { parseAuditCiOutput, runAudit, runReport } from "./run-audit.js";
|
|
10
10
|
import { syncAllowlist } from "./sync.js";
|
|
11
11
|
import { withTempDir } from "./tmp.js";
|
|
12
|
-
import { AUDIT_SCOPES, isSeverityAtOrAbove } from "./types.js";
|
|
12
|
+
import { AUDIT_SCOPES, isSeverityAtOrAbove, } from "./types.js";
|
|
13
13
|
export async function auditCommand(options) {
|
|
14
14
|
let loaded;
|
|
15
15
|
try {
|
package/dist/esm/config.d.ts
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type V11yCheckConfig } from './types.js';
|
|
2
|
+
/** Default config file path, relative to the working directory. */
|
|
2
3
|
export declare const DEFAULT_CONFIG_PATH = ".config/v11y-check.config.json";
|
|
4
|
+
/** Discriminate between a config loaded from a file and one built from defaults. */
|
|
3
5
|
export type ConfigSource = 'defaults' | 'file';
|
|
6
|
+
/** Result of loading config, including the source discriminator. */
|
|
4
7
|
export interface LoadConfigResult {
|
|
5
8
|
config: V11yCheckConfig;
|
|
6
9
|
configDir: string;
|
|
7
10
|
configFilePath: string;
|
|
8
11
|
configSource: ConfigSource;
|
|
9
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* Load and validate the v11y-check config from disk, falling back to defaults.
|
|
15
|
+
*
|
|
16
|
+
* When `configPath` is explicitly provided, the file must exist. When omitted,
|
|
17
|
+
* the default path is tried; if absent, `DEFAULT_CONFIG` is returned.
|
|
18
|
+
*/
|
|
10
19
|
export declare function loadConfig(configPath?: string, cwd?: string): Promise<LoadConfigResult>;
|
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
import type { CheckResult } from './format-check.js';
|
|
2
2
|
import type { AuditScope } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Compute the "Actions:" footer for check output.
|
|
5
|
+
*
|
|
6
|
+
* Returns an empty string when the allowlist is fully current. Otherwise returns
|
|
7
|
+
* a bulleted action list with a verbose hint (when vulns exist) and a sync hint.
|
|
8
|
+
*/
|
|
3
9
|
export declare function formatActionHints(result: CheckResult, scopes: AuditScope[]): string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { AuditResult, AuditScope, SeverityThreshold } from './types.js';
|
|
2
|
+
/** Classification of an allowlist entry relative to current audit findings. */
|
|
2
3
|
export interface AllowedVuln {
|
|
3
4
|
addedAt?: string | undefined;
|
|
4
5
|
cvss?: {
|
|
@@ -15,24 +16,37 @@ export interface AllowedVuln {
|
|
|
15
16
|
title?: string | undefined;
|
|
16
17
|
url: string;
|
|
17
18
|
}
|
|
19
|
+
/** An allowlist entry whose ID no longer appears in audit results. */
|
|
18
20
|
export interface StaleEntry {
|
|
19
21
|
id: string;
|
|
20
22
|
}
|
|
23
|
+
/** Check results for a single scope. */
|
|
21
24
|
export interface ScopeCheckResult {
|
|
22
25
|
allowed: AllowedVuln[];
|
|
23
26
|
belowThreshold: AuditResult[];
|
|
24
27
|
stale: StaleEntry[];
|
|
25
28
|
unallowed: AuditResult[];
|
|
26
29
|
}
|
|
30
|
+
/** Aggregated check results across scopes. */
|
|
27
31
|
export interface CheckResult {
|
|
28
32
|
dev: ScopeCheckResult;
|
|
29
33
|
prod: ScopeCheckResult;
|
|
30
34
|
}
|
|
35
|
+
/** Map a severity string to a colored circle emoji. */
|
|
31
36
|
export declare function severityIndicator(severity: string | undefined): string;
|
|
37
|
+
/** Resolve the best display ID for a vulnerability: GHSA ID if available, otherwise the numeric ID. */
|
|
32
38
|
export declare function displayId(vuln: {
|
|
33
39
|
ghsaId?: string | undefined;
|
|
34
40
|
id: string;
|
|
35
41
|
}): string;
|
|
42
|
+
/** Build the severity suffix for a finding line, e.g. ` 🔴 critical`. */
|
|
36
43
|
export declare function formatSeveritySuffix(severity: string | undefined): string;
|
|
44
|
+
/**
|
|
45
|
+
* Format check results as human-readable text output.
|
|
46
|
+
*
|
|
47
|
+
* Produces an intro banner, scoped findings with severity labels and GHSA IDs,
|
|
48
|
+
* and an action hints footer.
|
|
49
|
+
*/
|
|
37
50
|
export declare function formatCheckText(result: CheckResult, scopes: AuditScope[], now?: Date, thresholds?: Partial<Record<AuditScope, SeverityThreshold>>): string;
|
|
51
|
+
/** Format check results as a JSON string with a top-level `summary` block derived from the result. */
|
|
38
52
|
export declare function formatCheckJson(result: CheckResult, scopes: AuditScope[]): string;
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
import type { CheckResult } from './format-check.js';
|
|
2
2
|
import type { AuditScope } from './types.js';
|
|
3
|
+
/** Status discriminant exposing the most severe finding category in a check result. */
|
|
3
4
|
export type CheckSummaryStatus = 'vulnerabilities-found' | 'suppressed-vulnerabilities' | 'stale-overrides' | 'none';
|
|
5
|
+
/** Headline summary of a check run: status discriminant plus count for the active category. */
|
|
4
6
|
export interface CheckSummary {
|
|
5
7
|
status: CheckSummaryStatus;
|
|
6
8
|
count: number;
|
|
7
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* Derive the headline summary from a check result.
|
|
12
|
+
*
|
|
13
|
+
* Priority is severity-driven: unallowed > allowed > stale > none. The count is the total across
|
|
14
|
+
* the requested scopes for the *active* category only; for `'none'` it is `0`. Below-threshold
|
|
15
|
+
* findings never affect the summary — the threshold already excludes them from pass/fail.
|
|
16
|
+
*/
|
|
8
17
|
export declare function deriveSummary(result: CheckResult, scopes: AuditScope[]): CheckSummary;
|
|
@@ -1 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Produce a human-readable relative-time string such as "just now", "N minutes ago",
|
|
3
|
+
* "yesterday", "N months ago", "N years ago".
|
|
4
|
+
*
|
|
5
|
+
* Uses millisecond math for units up through weeks to avoid DST/timezone drift on
|
|
6
|
+
* short intervals, and UTC calendar math for months and years.
|
|
7
|
+
*
|
|
8
|
+
* @internal — exported for test access; consumers should use higher-level formatting helpers.
|
|
9
|
+
*/
|
|
1
10
|
export declare function formatRelativeTime(fromIso: string, now: Date): string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type CheckResult } from './format-check.js';
|
|
2
2
|
import type { AuditScope, SeverityThreshold } from './types.js';
|
|
3
|
+
/** Format the verbose per-vulnerability check output as text. */
|
|
3
4
|
export declare function formatCheckVerboseText(result: CheckResult, scopes: AuditScope[], now?: Date, thresholds?: Partial<Record<AuditScope, SeverityThreshold>>): string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { formatActionHints } from "./format-actions.js";
|
|
2
|
-
import { displayId, formatSeveritySuffix, severityIndicator } from "./format-check.js";
|
|
2
|
+
import { displayId, formatSeveritySuffix, severityIndicator, } from "./format-check.js";
|
|
3
3
|
import { formatRelativeTime } from "./format-time.js";
|
|
4
4
|
const STATUS_UNALLOWED = '\u{1F6A8}';
|
|
5
5
|
const STATUS_ALLOWED = '\u{26A0}\u{FE0F}';
|
package/dist/esm/generate.d.ts
CHANGED
|
@@ -1,9 +1,23 @@
|
|
|
1
1
|
import type { AuditScope, ScopeConfig } from './types.js';
|
|
2
|
+
/** Flat JSON shape that audit-ci expects as its config file. */
|
|
2
3
|
interface AuditCiFlatConfig {
|
|
3
4
|
[key: string]: boolean | string | string[] | undefined;
|
|
4
5
|
allowlist: string[];
|
|
5
6
|
'show-not-found'?: boolean;
|
|
6
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* Transform a scope config into the flat JSON structure audit-ci expects.
|
|
10
|
+
*
|
|
11
|
+
* Translates `severityThreshold` to the corresponding audit-ci boolean,
|
|
12
|
+
* adds scope-specific flags (`skip-dev` for prod, `extra-args: ["--dev"]` for dev),
|
|
13
|
+
* and flattens the typed allowlist to an array of ID strings.
|
|
14
|
+
*/
|
|
7
15
|
export declare function buildFlatConfig(scopeConfig: ScopeConfig, scope: AuditScope): AuditCiFlatConfig;
|
|
16
|
+
/**
|
|
17
|
+
* Generate the audit-ci config file for a scope and write it to disk.
|
|
18
|
+
*
|
|
19
|
+
* The output path is `{outputDir}/audit-ci.{scope}.json`. The caller must
|
|
20
|
+
* ensure `outputDir` already exists (e.g., via `withTempDir`).
|
|
21
|
+
*/
|
|
8
22
|
export declare function generateAuditCiConfig(scopeConfig: ScopeConfig, scope: AuditScope, outputDir: string): Promise<string>;
|
|
9
23
|
export {};
|
|
@@ -2,5 +2,11 @@ interface InitOptions {
|
|
|
2
2
|
dryRun: boolean;
|
|
3
3
|
force: boolean;
|
|
4
4
|
}
|
|
5
|
+
/**
|
|
6
|
+
* Run the `v11y init` command.
|
|
7
|
+
*
|
|
8
|
+
* Scaffolds the starter config file and the GitHub Actions workflow, then prints next steps.
|
|
9
|
+
* Returns the process exit code (0 for success, 1 if any write failed).
|
|
10
|
+
*/
|
|
5
11
|
export declare function initCommand({ dryRun, force }: InitOptions): number;
|
|
6
12
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type WriteResult } from '@williamthorsen/nmr-core';
|
|
2
2
|
interface ScaffoldOptions {
|
|
3
3
|
dryRun: boolean;
|
|
4
4
|
force: boolean;
|
|
@@ -6,8 +6,28 @@ interface ScaffoldOptions {
|
|
|
6
6
|
interface ScaffoldResult {
|
|
7
7
|
configResult: WriteResult;
|
|
8
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* Scaffold the v11y-check config file with sensible defaults.
|
|
11
|
+
*
|
|
12
|
+
* Returns `{ configResult }` to preserve the signature consumed by `syncCommand`, which predates
|
|
13
|
+
* the workflow scaffolding and treats the config result as a named field.
|
|
14
|
+
*/
|
|
9
15
|
export declare function scaffoldConfig({ dryRun, force }: ScaffoldOptions): ScaffoldResult;
|
|
16
|
+
/** Copy the bundled audit.yaml.template to `.github/workflows/audit.yaml` in the target repo. */
|
|
10
17
|
export declare function copyWorkflowTemplate(dryRun: boolean, overwrite: boolean): WriteResult;
|
|
18
|
+
/**
|
|
19
|
+
* Scaffold the GitHub Actions audit workflow to `.github/workflows/audit.yaml`.
|
|
20
|
+
*
|
|
21
|
+
* Wraps `copyWorkflowTemplate` to provide a stable seam for future post-write transformations
|
|
22
|
+
* (e.g., variable substitution) without changing call sites.
|
|
23
|
+
*/
|
|
11
24
|
export declare function scaffoldWorkflow(dryRun: boolean, overwrite: boolean): WriteResult;
|
|
25
|
+
/**
|
|
26
|
+
* Scaffold v11y-check files for the target repo.
|
|
27
|
+
*
|
|
28
|
+
* Writes both the config file and the GitHub Actions workflow. Returns a flat array of write
|
|
29
|
+
* results in the order [config, workflow]. `ScaffoldOptions.force` is translated to `overwrite`
|
|
30
|
+
* when calling the workflow helpers.
|
|
31
|
+
*/
|
|
12
32
|
export declare function scaffoldFiles({ dryRun, force }: ScaffoldOptions): WriteResult[];
|
|
13
33
|
export {};
|
package/dist/esm/run-audit.d.ts
CHANGED
|
@@ -1,21 +1,34 @@
|
|
|
1
1
|
import type { AuditResult } from './types.js';
|
|
2
|
+
/** Resolve the audit-ci binary path from node_modules. */
|
|
2
3
|
export declare function resolveAuditCiBin(): string;
|
|
4
|
+
/** Result of parsing audit-ci output, including any warnings. */
|
|
3
5
|
export interface ParseResult {
|
|
4
6
|
results: AuditResult[];
|
|
5
7
|
warnings: string[];
|
|
6
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* Parse audit-ci JSON output into typed audit results.
|
|
11
|
+
*
|
|
12
|
+
* Extracts advisories from the JSON, mapping each to an `AuditResult` with
|
|
13
|
+
* the first discovered dependency path. Returns warnings when input is
|
|
14
|
+
* non-empty but not parseable.
|
|
15
|
+
*/
|
|
7
16
|
export declare function parseAuditCiOutput(jsonString: string): ParseResult;
|
|
17
|
+
/** Result of extracting stale entries, including any warnings. */
|
|
8
18
|
export interface StaleEntriesResult {
|
|
9
19
|
entries: string[];
|
|
10
20
|
warnings: string[];
|
|
11
21
|
}
|
|
22
|
+
/** Extract stale allowlist entries from audit-ci JSON output. */
|
|
12
23
|
export declare function extractStaleEntries(jsonString: string): StaleEntriesResult;
|
|
24
|
+
/** Options for running audit-ci. */
|
|
13
25
|
interface RunAuditOptions {
|
|
14
26
|
configPath: string;
|
|
15
27
|
cwd?: string;
|
|
16
28
|
json?: boolean;
|
|
17
29
|
reportType?: 'full';
|
|
18
30
|
}
|
|
31
|
+
/** Result from a normal audit run. */
|
|
19
32
|
export interface AuditRunResult {
|
|
20
33
|
exitCode: number;
|
|
21
34
|
staleEntries: string[];
|
|
@@ -23,12 +36,25 @@ export interface AuditRunResult {
|
|
|
23
36
|
stderr: string;
|
|
24
37
|
warnings: string[];
|
|
25
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* Invoke audit-ci with the given config file in normal (CI) mode.
|
|
41
|
+
*
|
|
42
|
+
* Returns the exit code faithfully. When `json` is true, output is JSON;
|
|
43
|
+
* otherwise audit-ci uses its default text format. Stale overrides are
|
|
44
|
+
* detected from JSON output and returned.
|
|
45
|
+
*/
|
|
26
46
|
export declare function runAudit({ configPath, cwd, json }: RunAuditOptions): AuditRunResult;
|
|
47
|
+
/** Result from a report-mode audit run. */
|
|
27
48
|
export interface ReportResult {
|
|
28
49
|
results: AuditResult[];
|
|
29
50
|
stdout: string;
|
|
30
51
|
stderr: string;
|
|
31
52
|
warnings: string[];
|
|
32
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* Invoke audit-ci in report mode (no allowlist filtering, swallows exit code).
|
|
56
|
+
*
|
|
57
|
+
* Always returns exit code 0. Parses JSON output into typed `AuditResult` objects.
|
|
58
|
+
*/
|
|
33
59
|
export declare function runReport({ configPath, cwd, reportType }: Omit<RunAuditOptions, 'json'>): ReportResult;
|
|
34
60
|
export {};
|
package/dist/esm/sync.d.ts
CHANGED
|
@@ -1,19 +1,43 @@
|
|
|
1
1
|
import type { AllowlistEntry, AuditResult, AuditScope, V11yCheckConfig } from './types.js';
|
|
2
|
+
/** Produce a full ISO 8601 UTC datetime string. */
|
|
2
3
|
export declare function formatUtcDatetime(date: Date): string;
|
|
4
|
+
/** Format a Date as a human-friendly UTC string for use in reason messages. */
|
|
3
5
|
export declare function formatFriendlyUtc(date: Date): string;
|
|
6
|
+
/** Result of a sync operation for a single scope. */
|
|
4
7
|
export interface SyncResult {
|
|
5
8
|
added: AllowlistEntry[];
|
|
6
9
|
kept: AllowlistEntry[];
|
|
7
10
|
removed: AllowlistEntry[];
|
|
8
11
|
scope: AuditScope;
|
|
9
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* Compute the updated allowlist by diffing audit results against the current entries.
|
|
15
|
+
*
|
|
16
|
+
* New advisories are added with an auto-populated reason. Resolved advisories are removed.
|
|
17
|
+
* Existing entries with a non-empty reason are preserved.
|
|
18
|
+
*/
|
|
10
19
|
export declare function computeSyncDiff(currentAllowlist: AllowlistEntry[], auditResults: AuditResult[], date?: Date): {
|
|
11
20
|
added: AllowlistEntry[];
|
|
12
21
|
kept: AllowlistEntry[];
|
|
13
22
|
removed: AllowlistEntry[];
|
|
14
23
|
};
|
|
24
|
+
/**
|
|
25
|
+
* Build the updated config by replacing the allowlist for the given scope.
|
|
26
|
+
*
|
|
27
|
+
* Returns a new config object; does not mutate the input.
|
|
28
|
+
*/
|
|
15
29
|
export declare function buildUpdatedConfig(config: V11yCheckConfig, scope: AuditScope, newAllowlist: AllowlistEntry[]): V11yCheckConfig;
|
|
30
|
+
/**
|
|
31
|
+
* Serialize the config to JSON with alphabetically ordered allowlist entry keys.
|
|
32
|
+
*
|
|
33
|
+
* Includes `$schema` when present. Uses `severityThreshold` instead of boolean fields.
|
|
34
|
+
*/
|
|
16
35
|
export declare function serializeConfig(config: V11yCheckConfig): string;
|
|
36
|
+
/**
|
|
37
|
+
* Synchronize the allowlist for a scope by diffing audit results against the current config.
|
|
38
|
+
*
|
|
39
|
+
* Returns the sync diff and the updated config. Writes the updated config to disk.
|
|
40
|
+
*/
|
|
17
41
|
export declare function syncAllowlist(config: V11yCheckConfig, scope: AuditScope, auditResults: AuditResult[], configFilePath: string, date?: Date): Promise<{
|
|
18
42
|
syncResult: SyncResult;
|
|
19
43
|
updatedConfig: V11yCheckConfig;
|
package/dist/esm/tmp.d.ts
CHANGED
|
@@ -1 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Execute a callback with a temporary directory, ensuring cleanup afterward.
|
|
3
|
+
*
|
|
4
|
+
* Creates a unique temp directory under `os.tmpdir()` and removes it
|
|
5
|
+
* (recursively) when the callback completes or throws.
|
|
6
|
+
*
|
|
7
|
+
* @internal Exported for testing.
|
|
8
|
+
*/
|
|
1
9
|
export declare function withTempDir<T>(fn: (tempDir: string) => Promise<T>): Promise<T>;
|
package/dist/esm/types.d.ts
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
/** The dependency scope to audit: development or production. */
|
|
2
3
|
export type AuditScope = 'dev' | 'prod';
|
|
4
|
+
/** All valid scope values. */
|
|
3
5
|
export declare const AUDIT_SCOPES: readonly AuditScope[];
|
|
6
|
+
/** Valid severity threshold values in ascending order. */
|
|
4
7
|
export declare const SEVERITY_THRESHOLDS: readonly ["low", "moderate", "high", "critical"];
|
|
8
|
+
/** Severity level at or above which audit-ci should fail. */
|
|
5
9
|
export type SeverityThreshold = (typeof SEVERITY_THRESHOLDS)[number];
|
|
10
|
+
/** A single allowlisted advisory with metadata for traceability. */
|
|
6
11
|
export interface AllowlistEntry {
|
|
7
12
|
addedAt?: string | undefined;
|
|
8
13
|
id: string;
|
|
@@ -10,6 +15,7 @@ export interface AllowlistEntry {
|
|
|
10
15
|
reason?: string | undefined;
|
|
11
16
|
url: string;
|
|
12
17
|
}
|
|
18
|
+
/** Zod schema for an allowlist entry. */
|
|
13
19
|
export declare const allowlistEntrySchema: z.ZodObject<{
|
|
14
20
|
addedAt: z.ZodOptional<z.ZodString>;
|
|
15
21
|
id: z.ZodString;
|
|
@@ -17,10 +23,13 @@ export declare const allowlistEntrySchema: z.ZodObject<{
|
|
|
17
23
|
reason: z.ZodOptional<z.ZodString>;
|
|
18
24
|
url: z.ZodString;
|
|
19
25
|
}, z.core.$strip>;
|
|
26
|
+
/** Configuration for a single audit scope (dev or prod). */
|
|
20
27
|
export interface ScopeConfig {
|
|
21
28
|
allowlist: AllowlistEntry[];
|
|
29
|
+
/** Fail on advisories at or above this severity. */
|
|
22
30
|
severityThreshold?: SeverityThreshold | undefined;
|
|
23
31
|
}
|
|
32
|
+
/** Zod schema for a scope configuration block. */
|
|
24
33
|
export declare const scopeConfigSchema: z.ZodObject<{
|
|
25
34
|
allowlist: z.ZodArray<z.ZodObject<{
|
|
26
35
|
addedAt: z.ZodOptional<z.ZodString>;
|
|
@@ -36,11 +45,13 @@ export declare const scopeConfigSchema: z.ZodObject<{
|
|
|
36
45
|
critical: "critical";
|
|
37
46
|
}>>;
|
|
38
47
|
}, z.core.$strict>;
|
|
48
|
+
/** Source-of-truth configuration for v11y-check. */
|
|
39
49
|
export interface V11yCheckConfig {
|
|
40
50
|
$schema?: string | undefined;
|
|
41
51
|
dev: ScopeConfig;
|
|
42
52
|
prod: ScopeConfig;
|
|
43
53
|
}
|
|
54
|
+
/** Zod schema for the full v11y-check configuration file. */
|
|
44
55
|
export declare const v11yCheckConfigSchema: z.ZodObject<{
|
|
45
56
|
$schema: z.ZodOptional<z.ZodString>;
|
|
46
57
|
dev: z.ZodObject<{
|
|
@@ -74,7 +85,9 @@ export declare const v11yCheckConfigSchema: z.ZodObject<{
|
|
|
74
85
|
}>>;
|
|
75
86
|
}, z.core.$strict>;
|
|
76
87
|
}, z.core.$strict>;
|
|
88
|
+
/** Built-in defaults used when no config file is present. */
|
|
77
89
|
export declare const DEFAULT_CONFIG: V11yCheckConfig;
|
|
90
|
+
/** A single vulnerability found by audit-ci. */
|
|
78
91
|
export interface AuditResult {
|
|
79
92
|
cvss?: {
|
|
80
93
|
score?: number;
|
|
@@ -89,10 +102,19 @@ export interface AuditResult {
|
|
|
89
102
|
title?: string | undefined;
|
|
90
103
|
url: string;
|
|
91
104
|
}
|
|
105
|
+
/** Parsed CLI options shared across subcommands. */
|
|
92
106
|
export interface CommandOptions {
|
|
93
107
|
configPath?: string | undefined;
|
|
94
108
|
json: boolean;
|
|
95
109
|
scopes: AuditScope[];
|
|
96
110
|
verbose: boolean;
|
|
97
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* Determine whether a severity string is at or above the given threshold.
|
|
114
|
+
*
|
|
115
|
+
* Unrecognized or undefined severities are treated as above threshold
|
|
116
|
+
* (conservative — surfaces unknown vulns rather than hiding them).
|
|
117
|
+
*
|
|
118
|
+
* @internal Exported for testing.
|
|
119
|
+
*/
|
|
98
120
|
export declare function isSeverityAtOrAbove(severity: string | undefined, threshold: SeverityThreshold): boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "v11y-check",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.8",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Wrap audit-ci with a richer config model, typed JSON source of truth, and sync workflow",
|
|
6
6
|
"keywords": [
|
|
@@ -43,16 +43,16 @@
|
|
|
43
43
|
"templates"
|
|
44
44
|
],
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@williamthorsen/
|
|
46
|
+
"@williamthorsen/nmr-core": "0.10.4",
|
|
47
|
+
"@williamthorsen/toolbelt.errors": "0.6.3",
|
|
47
48
|
"audit-ci": "7.1.0",
|
|
48
|
-
"zod": "4.4.3"
|
|
49
|
-
"@williamthorsen/nmr-core": "0.10.2"
|
|
49
|
+
"zod": "4.4.3"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@williamthorsen/toolbelt.filesystem": "0.
|
|
53
|
-
"@williamthorsen/toolbelt.testing": "0.
|
|
54
|
-
"@williamthorsen/toolbelt.vitest": "0.
|
|
55
|
-
"readyup": "0.
|
|
52
|
+
"@williamthorsen/toolbelt.filesystem": "0.8.2",
|
|
53
|
+
"@williamthorsen/toolbelt.testing": "0.5.0",
|
|
54
|
+
"@williamthorsen/toolbelt.vitest": "0.8.0",
|
|
55
|
+
"readyup": "0.35.0"
|
|
56
56
|
},
|
|
57
57
|
"engines": {
|
|
58
58
|
"node": ">=24"
|