@xenos1996/usa 2.26.2 → 2.28.0
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/dist/cli-help.d.ts.map +1 -1
- package/dist/cli-help.js +2 -0
- package/dist/cli-help.js.map +1 -1
- package/dist/cli-intent.d.ts +4 -0
- package/dist/cli-intent.d.ts.map +1 -0
- package/dist/cli-intent.js +108 -0
- package/dist/cli-intent.js.map +1 -0
- package/dist/cli-scan.d.ts +12 -0
- package/dist/cli-scan.d.ts.map +1 -0
- package/dist/cli-scan.js +142 -0
- package/dist/cli-scan.js.map +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +4 -0
- package/dist/cli.js.map +1 -1
- package/dist/engine/audit-config.d.ts +66 -0
- package/dist/engine/audit-config.d.ts.map +1 -0
- package/dist/engine/audit-config.js +148 -0
- package/dist/engine/audit-config.js.map +1 -0
- package/dist/engine/audit-types.d.ts +44 -0
- package/dist/engine/audit-types.d.ts.map +1 -0
- package/dist/engine/audit-types.js +2 -0
- package/dist/engine/audit-types.js.map +1 -0
- package/dist/engine/audit-warnings.d.ts +56 -0
- package/dist/engine/audit-warnings.d.ts.map +1 -0
- package/dist/engine/audit-warnings.js +116 -0
- package/dist/engine/audit-warnings.js.map +1 -0
- package/dist/engine/audit.d.ts +14 -38
- package/dist/engine/audit.d.ts.map +1 -1
- package/dist/engine/audit.js +9 -500
- package/dist/engine/audit.js.map +1 -1
- package/dist/engine/evaluate-packs.d.ts +37 -0
- package/dist/engine/evaluate-packs.d.ts.map +1 -0
- package/dist/engine/evaluate-packs.js +144 -0
- package/dist/engine/evaluate-packs.js.map +1 -0
- package/dist/engine/evaluate.d.ts.map +1 -1
- package/dist/engine/evaluate.js +31 -8
- package/dist/engine/evaluate.js.map +1 -1
- package/dist/engine/invariants.d.ts +8 -0
- package/dist/engine/invariants.d.ts.map +1 -1
- package/dist/engine/invariants.js +11 -0
- package/dist/engine/invariants.js.map +1 -1
- package/dist/engine/pack-selection.d.ts +21 -0
- package/dist/engine/pack-selection.d.ts.map +1 -0
- package/dist/engine/pack-selection.js +63 -0
- package/dist/engine/pack-selection.js.map +1 -0
- package/dist/engine/report-build.d.ts +22 -0
- package/dist/engine/report-build.d.ts.map +1 -0
- package/dist/engine/report-build.js +67 -0
- package/dist/engine/report-build.js.map +1 -0
- package/dist/foundation/interview.d.ts.map +1 -1
- package/dist/foundation/interview.js +16 -5
- package/dist/foundation/interview.js.map +1 -1
- package/dist/intent/match.d.ts +38 -0
- package/dist/intent/match.d.ts.map +1 -0
- package/dist/intent/match.js +108 -0
- package/dist/intent/match.js.map +1 -0
- package/dist/intent/otm.d.ts +16 -0
- package/dist/intent/otm.d.ts.map +1 -0
- package/dist/intent/otm.js +144 -0
- package/dist/intent/otm.js.map +1 -0
- package/dist/intent/types.d.ts +111 -0
- package/dist/intent/types.d.ts.map +1 -0
- package/dist/intent/types.js +16 -0
- package/dist/intent/types.js.map +1 -0
- package/dist/scanner/adapters/codeql.d.ts +14 -0
- package/dist/scanner/adapters/codeql.d.ts.map +1 -0
- package/dist/scanner/adapters/codeql.js +134 -0
- package/dist/scanner/adapters/codeql.js.map +1 -0
- package/dist/scanner/adapters/dependency-cruiser.d.ts +3 -0
- package/dist/scanner/adapters/dependency-cruiser.d.ts.map +1 -0
- package/dist/scanner/adapters/dependency-cruiser.js +174 -0
- package/dist/scanner/adapters/dependency-cruiser.js.map +1 -0
- package/dist/scanner/adapters/ort.d.ts +12 -0
- package/dist/scanner/adapters/ort.d.ts.map +1 -0
- package/dist/scanner/adapters/ort.js +259 -0
- package/dist/scanner/adapters/ort.js.map +1 -0
- package/dist/scanner/adapters/scorecard.d.ts +7 -0
- package/dist/scanner/adapters/scorecard.d.ts.map +1 -0
- package/dist/scanner/adapters/scorecard.js +209 -0
- package/dist/scanner/adapters/scorecard.js.map +1 -0
- package/dist/scanner/adapters/semgrep.d.ts +3 -0
- package/dist/scanner/adapters/semgrep.d.ts.map +1 -0
- package/dist/scanner/adapters/semgrep.js +163 -0
- package/dist/scanner/adapters/semgrep.js.map +1 -0
- package/dist/scanner/adapters/trivy.d.ts +3 -0
- package/dist/scanner/adapters/trivy.d.ts.map +1 -0
- package/dist/scanner/adapters/trivy.js +163 -0
- package/dist/scanner/adapters/trivy.js.map +1 -0
- package/dist/scanner/config.d.ts +4 -0
- package/dist/scanner/config.d.ts.map +1 -0
- package/dist/scanner/config.js +15 -0
- package/dist/scanner/config.js.map +1 -0
- package/dist/scanner/identity.d.ts +17 -0
- package/dist/scanner/identity.d.ts.map +1 -0
- package/dist/scanner/identity.js +50 -0
- package/dist/scanner/identity.js.map +1 -0
- package/dist/scanner/normalize.d.ts +40 -0
- package/dist/scanner/normalize.d.ts.map +1 -0
- package/dist/scanner/normalize.js +85 -0
- package/dist/scanner/normalize.js.map +1 -0
- package/dist/scanner/registry.d.ts +19 -0
- package/dist/scanner/registry.d.ts.map +1 -0
- package/dist/scanner/registry.js +43 -0
- package/dist/scanner/registry.js.map +1 -0
- package/dist/scanner/run.d.ts +70 -0
- package/dist/scanner/run.d.ts.map +1 -0
- package/dist/scanner/run.js +419 -0
- package/dist/scanner/run.js.map +1 -0
- package/dist/scanner/sarif.d.ts +21 -0
- package/dist/scanner/sarif.d.ts.map +1 -0
- package/dist/scanner/sarif.js +156 -0
- package/dist/scanner/sarif.js.map +1 -0
- package/dist/scanner/types.d.ts +236 -0
- package/dist/scanner/types.d.ts.map +1 -0
- package/dist/scanner/types.js +11 -0
- package/dist/scanner/types.js.map +1 -0
- package/package.json +9 -8
- package/rules/core/code-quality.yaml +12 -2
- package/rules/core/provenance-attestation.yaml +5 -0
- package/rules/core/testing-assurance.yaml +19 -4
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scanner subsystem types.
|
|
3
|
+
*
|
|
4
|
+
* These are the only types the adapter layer owns, and nothing in `src/engine/`
|
|
5
|
+
* imports them: a rule consumes scanner *artifacts* through the existing
|
|
6
|
+
* `oracle` check (ADR-0011) instead of importing evidence objects. That keeps
|
|
7
|
+
* the dependency direction one-way and keeps the rule engine free of any
|
|
8
|
+
* scanner-specific schema.
|
|
9
|
+
*/
|
|
10
|
+
/** The tool's own severity word, quoted verbatim and never re-mapped. */
|
|
11
|
+
export type ScannerSeverity = 'CRITICAL' | 'HIGH' | 'MEDIUM' | 'LOW' | 'INFO';
|
|
12
|
+
/**
|
|
13
|
+
* A scanner's verdict about its own observation — NOT a rule status.
|
|
14
|
+
* `UNAVAILABLE` exists so that "no evidence found" can never be read as
|
|
15
|
+
* "the feature does not exist" (Phase 5's hard requirement).
|
|
16
|
+
*/
|
|
17
|
+
export type ScannerVerdict = 'PASS' | 'FAIL' | 'PARTIAL' | 'UNKNOWN' | 'NOT_APPLICABLE' | 'UNAVAILABLE';
|
|
18
|
+
export type ScannerStatus = 'ok' | 'unavailable' | 'timeout' | 'error' | 'skipped';
|
|
19
|
+
/**
|
|
20
|
+
* One fact, observed by a tool, with enough provenance to re-find it.
|
|
21
|
+
*
|
|
22
|
+
* The `id` is a content hash over source + identifier + location + claim, so the
|
|
23
|
+
* same observation deduplicates across tools and across runs.
|
|
24
|
+
*/
|
|
25
|
+
export interface Evidence {
|
|
26
|
+
/** Stable content hash (EVT-<hex>). */
|
|
27
|
+
id: string;
|
|
28
|
+
source: EvidenceSource;
|
|
29
|
+
provenance: EvidenceProvenance;
|
|
30
|
+
claim: string;
|
|
31
|
+
severity: ScannerSeverity;
|
|
32
|
+
severitySource: 'tool-native' | 'adapter-default';
|
|
33
|
+
confidence: number;
|
|
34
|
+
status: ScannerVerdict;
|
|
35
|
+
/** Where to look. `null` means the tool does not locate — never "everywhere". */
|
|
36
|
+
location: EvidenceLocation | null;
|
|
37
|
+
/** Pointer back into the raw tool output, for re-reading. */
|
|
38
|
+
rawReference: RawReference;
|
|
39
|
+
/**
|
|
40
|
+
* CWE ids the tool itself attached to this finding (`CWE-79`).
|
|
41
|
+
*
|
|
42
|
+
* Structured rather than inferred from the claim text, because this is the
|
|
43
|
+
* join key between scanner evidence and a declared threat model — and a join
|
|
44
|
+
* built on substring matching would invent relationships.
|
|
45
|
+
*/
|
|
46
|
+
cwes?: string[];
|
|
47
|
+
}
|
|
48
|
+
export interface EvidenceSource {
|
|
49
|
+
/** Adapter id, e.g. `trivy`. */
|
|
50
|
+
tool: string;
|
|
51
|
+
/** Tool version, as reported by `tool --version`. */
|
|
52
|
+
version: string;
|
|
53
|
+
/** Tool-native category (e.g. `vulnerability`, `secret`, `dependency-edge`). */
|
|
54
|
+
kind: string;
|
|
55
|
+
/** Tool-native identifier, preserved verbatim (CVE id, rule id, …). */
|
|
56
|
+
identifier: string;
|
|
57
|
+
}
|
|
58
|
+
export interface EvidenceProvenance {
|
|
59
|
+
executionId: string;
|
|
60
|
+
/** argv actually executed, for a re-run. */
|
|
61
|
+
command: string[];
|
|
62
|
+
/**
|
|
63
|
+
* Upstream stages that ran before `command`, in order. Present so that a
|
|
64
|
+
* provenance record reproduces the run rather than only its last step.
|
|
65
|
+
*/
|
|
66
|
+
preparedBy?: string[][];
|
|
67
|
+
/** Adapter config in effect, including rule-pack versions. */
|
|
68
|
+
config: Record<string, unknown>;
|
|
69
|
+
/** The commit the target pointed at, or `unversioned`. */
|
|
70
|
+
repositoryRevision: string;
|
|
71
|
+
timestamp: string;
|
|
72
|
+
executable: string;
|
|
73
|
+
/** Command timeout in milliseconds. */
|
|
74
|
+
timeoutMs: number;
|
|
75
|
+
/** Seconds the tool ran. */
|
|
76
|
+
elapsedMs: number;
|
|
77
|
+
}
|
|
78
|
+
export interface EvidenceLocation {
|
|
79
|
+
file: string;
|
|
80
|
+
line?: number;
|
|
81
|
+
column?: number;
|
|
82
|
+
}
|
|
83
|
+
export interface RawReference {
|
|
84
|
+
/** Byte offset into the artifact the claim came from. */
|
|
85
|
+
artifactOffset?: number;
|
|
86
|
+
jsonPath?: string;
|
|
87
|
+
excerpt?: string;
|
|
88
|
+
}
|
|
89
|
+
/** A finding produced directly from scanner evidence (path 2). */
|
|
90
|
+
export interface ScannerFinding {
|
|
91
|
+
id: string;
|
|
92
|
+
ruleId: string;
|
|
93
|
+
title: string;
|
|
94
|
+
claim: string;
|
|
95
|
+
severity: ScannerSeverity;
|
|
96
|
+
confidence: number;
|
|
97
|
+
status: ScannerVerdict;
|
|
98
|
+
evidenceIds: string[];
|
|
99
|
+
remediation: string;
|
|
100
|
+
locations: EvidenceLocation[];
|
|
101
|
+
}
|
|
102
|
+
/** One adapter's record in the run manifest — coverage as a first-class fact. */
|
|
103
|
+
export interface AdapterRun {
|
|
104
|
+
id: string;
|
|
105
|
+
available: boolean;
|
|
106
|
+
version: string;
|
|
107
|
+
command: string[];
|
|
108
|
+
/** Upstream stages that ran before `command`, in order. */
|
|
109
|
+
prepare?: string[][];
|
|
110
|
+
/** Artifact the evidence was parsed from, relative to the workdir. */
|
|
111
|
+
artifact?: string;
|
|
112
|
+
status: ScannerStatus;
|
|
113
|
+
/** Why an adapter did not produce evidence. Mandatory unless ok. */
|
|
114
|
+
reason?: string;
|
|
115
|
+
/**
|
|
116
|
+
* The process exit status, recorded and never interpreted.
|
|
117
|
+
*
|
|
118
|
+
* Tools disagree about what a non-zero status means: ORT exits 2 when it
|
|
119
|
+
* found violations (the run succeeded), while a usage error is also non-zero.
|
|
120
|
+
* The verdict comes from the parsed payload; the status is here so a reader
|
|
121
|
+
* can tell "it ran and objected" from "it never started".
|
|
122
|
+
*/
|
|
123
|
+
exitCode?: number;
|
|
124
|
+
evidenceCount: number;
|
|
125
|
+
elapsedMs: number;
|
|
126
|
+
needsNetwork: boolean;
|
|
127
|
+
}
|
|
128
|
+
export interface RunManifest {
|
|
129
|
+
executionId: string;
|
|
130
|
+
target: string;
|
|
131
|
+
repositoryRevision: string;
|
|
132
|
+
timestamp: string;
|
|
133
|
+
adapters: AdapterRun[];
|
|
134
|
+
environment: {
|
|
135
|
+
sandbox: string;
|
|
136
|
+
network: 'denied' | 'allowed';
|
|
137
|
+
outputCapBytes: number;
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
/** Everything an adapter needs to describe how it should run. */
|
|
141
|
+
export interface ScanTarget {
|
|
142
|
+
/** Absolute path to the audited project. */
|
|
143
|
+
path: string;
|
|
144
|
+
/** Scratch copy working directory; adapters run here, never in `path`. */
|
|
145
|
+
workdir: string;
|
|
146
|
+
revision: string;
|
|
147
|
+
executionId: string;
|
|
148
|
+
}
|
|
149
|
+
/** One process in a staged tool's pipeline (ORT `analyze`, CodeQL `create`). */
|
|
150
|
+
export interface ScannerStage {
|
|
151
|
+
argv: string[];
|
|
152
|
+
/** Overrides the command timeout for this stage alone. */
|
|
153
|
+
timeoutMs?: number;
|
|
154
|
+
}
|
|
155
|
+
export interface ScannerCommand {
|
|
156
|
+
/** The command that produces the evidence. */
|
|
157
|
+
argv: string[];
|
|
158
|
+
/**
|
|
159
|
+
* Stages that must succeed before `argv` runs.
|
|
160
|
+
*
|
|
161
|
+
* Some tools are pipelines, not single processes: ORT's `evaluate` reads a
|
|
162
|
+
* result file that `analyze` writes, and CodeQL's `analyze` reads a database
|
|
163
|
+
* that `create` writes. Without this the adapter can only describe a command
|
|
164
|
+
* that will always fail on a fresh checkout.
|
|
165
|
+
*/
|
|
166
|
+
prepare?: ScannerStage[];
|
|
167
|
+
/**
|
|
168
|
+
* Files the tool writes its parseable output to, relative to the scan
|
|
169
|
+
* workdir. The first that exists is read and handed to `parse` instead of
|
|
170
|
+
* stdout.
|
|
171
|
+
*
|
|
172
|
+
* Measured, not assumed: ORT's `evaluate` and CodeQL's `analyze` write JSON
|
|
173
|
+
* to a file and log to stdout, so an adapter that parses stdout gets progress
|
|
174
|
+
* lines where it expected violations.
|
|
175
|
+
*/
|
|
176
|
+
artifacts?: string[];
|
|
177
|
+
network?: boolean;
|
|
178
|
+
/** Extra wall-time for slow tools (database builds). */
|
|
179
|
+
timeoutMs?: number;
|
|
180
|
+
}
|
|
181
|
+
export interface ScannerConfig {
|
|
182
|
+
[key: string]: unknown;
|
|
183
|
+
}
|
|
184
|
+
export interface AdapterProbe {
|
|
185
|
+
available: boolean;
|
|
186
|
+
version: string;
|
|
187
|
+
/** Why it is unavailable, when it is. */
|
|
188
|
+
reason?: string;
|
|
189
|
+
executable?: string;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* The contract every scanner lives behind.
|
|
193
|
+
*
|
|
194
|
+
* `buildCommand` and `parse` are pure functions of their inputs — that is what
|
|
195
|
+
* makes a scanner testable without being installed.
|
|
196
|
+
*/
|
|
197
|
+
export interface ScannerAdapter {
|
|
198
|
+
readonly id: string;
|
|
199
|
+
readonly name: string;
|
|
200
|
+
/** True when a run may need network access (declared in the manifest). */
|
|
201
|
+
readonly needsNetwork?: boolean;
|
|
202
|
+
/**
|
|
203
|
+
* The `.usa/scanners.yaml` key that removes this adapter's network need, e.g.
|
|
204
|
+
* `scanners.semgrep.rules`. Named in the refusal message, because "needs
|
|
205
|
+
* network" is only actionable if the reader knows what to change.
|
|
206
|
+
*/
|
|
207
|
+
readonly networkConfigKey?: string;
|
|
208
|
+
defaultConfig(): ScannerConfig;
|
|
209
|
+
probe(): AdapterProbe;
|
|
210
|
+
buildCommand(target: ScanTarget, config: ScannerConfig): ScannerCommand;
|
|
211
|
+
parse(raw: string, context: ParseContext): Evidence[];
|
|
212
|
+
findings?(evidence: Evidence[]): ScannerFinding[];
|
|
213
|
+
}
|
|
214
|
+
export interface ParseContext {
|
|
215
|
+
adapterId: string;
|
|
216
|
+
adapterVersion: string;
|
|
217
|
+
target: ScanTarget;
|
|
218
|
+
config: ScannerConfig;
|
|
219
|
+
}
|
|
220
|
+
export interface ScanOptions {
|
|
221
|
+
target: string;
|
|
222
|
+
/** Adapter ids to run; default = all enabled in config. */
|
|
223
|
+
adapters?: string[];
|
|
224
|
+
config?: Record<string, ScannerConfig>;
|
|
225
|
+
/** Refuse to run anything that needs a build step (default true). */
|
|
226
|
+
allowBuildCommands?: boolean;
|
|
227
|
+
network?: boolean;
|
|
228
|
+
timeoutMs?: number;
|
|
229
|
+
now?: () => Date;
|
|
230
|
+
}
|
|
231
|
+
export interface ScanResult {
|
|
232
|
+
manifest: RunManifest;
|
|
233
|
+
evidence: Evidence[];
|
|
234
|
+
findings: ScannerFinding[];
|
|
235
|
+
}
|
|
236
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/scanner/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,yEAAyE;AACzE,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAC;AAE9E;;;;GAIG;AACH,MAAM,MAAM,cAAc,GACtB,MAAM,GACN,MAAM,GACN,SAAS,GACT,SAAS,GACT,gBAAgB,GAChB,aAAa,CAAC;AAElB,MAAM,MAAM,aAAa,GAAG,IAAI,GAAG,aAAa,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;AAEnF;;;;;GAKG;AACH,MAAM,WAAW,QAAQ;IACvB,uCAAuC;IACvC,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,cAAc,CAAC;IACvB,UAAU,EAAE,kBAAkB,CAAC;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,eAAe,CAAC;IAC1B,cAAc,EAAE,aAAa,GAAG,iBAAiB,CAAC;IAClD,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,cAAc,CAAC;IACvB,iFAAiF;IACjF,QAAQ,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAClC,6DAA6D;IAC7D,YAAY,EAAE,YAAY,CAAC;IAC3B;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,MAAM,WAAW,cAAc;IAC7B,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,qDAAqD;IACrD,OAAO,EAAE,MAAM,CAA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EAAE,MAAM,EAAE,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IACvC,qEAAqE;IACrE,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,IAAI,CAAC;CAClB;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,WAAW,CAAC;IACtB,QAAQ,EAAE,QAAQ,EAAE,CAAC;IACrB,QAAQ,EAAE,cAAc,EAAE,CAAC;CAC5B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scanner subsystem types.
|
|
3
|
+
*
|
|
4
|
+
* These are the only types the adapter layer owns, and nothing in `src/engine/`
|
|
5
|
+
* imports them: a rule consumes scanner *artifacts* through the existing
|
|
6
|
+
* `oracle` check (ADR-0011) instead of importing evidence objects. That keeps
|
|
7
|
+
* the dependency direction one-way and keeps the rule engine free of any
|
|
8
|
+
* scanner-specific schema.
|
|
9
|
+
*/
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/scanner/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xenos1996/usa",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.28.0",
|
|
4
4
|
"description": "Universal Software Auditor — an open-source, self-adapting audit framework for any project, any stack, any stage",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -71,17 +71,18 @@
|
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@changesets/changelog-github": "^1.0.1",
|
|
73
73
|
"@changesets/cli": "^3.0.3",
|
|
74
|
-
"@commitlint/cli": "^21.2.
|
|
75
|
-
"@commitlint/config-conventional": "^21.2.
|
|
74
|
+
"@commitlint/cli": "^21.2.3",
|
|
75
|
+
"@commitlint/config-conventional": "^21.2.3",
|
|
76
76
|
"@eslint/js": "^10.0.1",
|
|
77
|
-
"@types/node": "^26.
|
|
77
|
+
"@types/node": "^26.6.4",
|
|
78
78
|
"@vitest/coverage-v8": "^5.0.0",
|
|
79
|
-
"eslint": "^10.
|
|
79
|
+
"eslint": "^10.12.0",
|
|
80
80
|
"husky": "^9.1.7",
|
|
81
|
-
"lint-staged": "^17.
|
|
82
|
-
"prettier": "^3.
|
|
81
|
+
"lint-staged": "^17.6.0",
|
|
82
|
+
"prettier": "^3.9.9",
|
|
83
83
|
"typescript": "^5.7.3",
|
|
84
|
-
"typescript-eslint": "^8.
|
|
84
|
+
"typescript-eslint": "^8.71.0",
|
|
85
|
+
"vite": "^8.3.3",
|
|
85
86
|
"vitest": "^5.0.0"
|
|
86
87
|
},
|
|
87
88
|
"scripts": {
|
|
@@ -100,7 +100,12 @@ rules:
|
|
|
100
100
|
applies_when: { fact: 'lang:typescript' }
|
|
101
101
|
check:
|
|
102
102
|
kind: grep_absent
|
|
103
|
-
|
|
103
|
+
# `:\s*any\b` alone matched prose — "Degraded-never-empty: any fetch
|
|
104
|
+
# failure" in a doc comment — so the type-escape branch now requires a
|
|
105
|
+
# type position after the keyword (`: any,` `: any)` `: any[]` `: any =`).
|
|
106
|
+
# Masking comments instead is not an option here: `@ts-ignore` lives in a
|
|
107
|
+
# comment, and the rule exists to catch it.
|
|
108
|
+
pattern: '(@ts-ignore|@ts-expect-error|:\s*any\b(?=\s*[,;)\]}>=]|$)|\bas any\b|as unknown as)'
|
|
104
109
|
include: ['**/*.{ts,tsx}']
|
|
105
110
|
exclude: ['**/*.test.*', '**/*.spec.*', '**/*.d.ts']
|
|
106
111
|
why: 'Every `any` is a place the type system was told to stop helping. A few are fine; a pattern is a problem.'
|
|
@@ -204,7 +209,12 @@ rules:
|
|
|
204
209
|
kind: grep_wrong
|
|
205
210
|
pattern: '(TODO|FIXME|XXX|HACK|WORKAROUND)\b'
|
|
206
211
|
include: ['**/*.{ts,tsx,js,jsx,py,go,rs,java,kt,rb,php,cs,yml,yaml}']
|
|
207
|
-
|
|
212
|
+
# A fixture is a *sample of bad code*, not debt: CQ-010.yaml contains a
|
|
213
|
+
# TODO precisely so this rule has something to flag. Excluding them here
|
|
214
|
+
# (rather than from the audit index) keeps the fixtures visible to the
|
|
215
|
+
# rules that need to see them, e.g. TAS-011.
|
|
216
|
+
exclude:
|
|
217
|
+
['**/*.md', '**/docs/**', '**/node_modules/**', '**/fixtures/**', '**/__fixtures__/**']
|
|
208
218
|
why: 'A TODO with no owner and no ticket is a lie the codebase tells itself.'
|
|
209
219
|
remediation: 'Convert each one to a tracked issue with a link in the comment, or delete it if it no longer applies.'
|
|
210
220
|
|
|
@@ -58,6 +58,11 @@ rules:
|
|
|
58
58
|
# An empty signature file signs nothing — presence alone is not evidence.
|
|
59
59
|
non_empty: true
|
|
60
60
|
files:
|
|
61
|
+
# cosign's own default bundle name is `<artifact>.sigstore.json`
|
|
62
|
+
# (`cosign sign-blob --bundle x.sigstore.json`), which `*.sigstore`
|
|
63
|
+
# does not match — that gap made every cosign-signed repo fail this
|
|
64
|
+
# rule. `*.sigstore` stays for legacy bundles written with that suffix.
|
|
65
|
+
- '**/*.sigstore.json'
|
|
61
66
|
- '**/*.sigstore'
|
|
62
67
|
- '**/*.bundle'
|
|
63
68
|
- '**/*.sig'
|
|
@@ -137,11 +137,22 @@ rules:
|
|
|
137
137
|
patterns:
|
|
138
138
|
- 'reports/**/*mut*'
|
|
139
139
|
- 'reports/mutation/**'
|
|
140
|
+
# Stryker's default config file has been `stryker.config.*` since v6;
|
|
141
|
+
# `stryker.conf.*` is the pre-6 name and is kept for older projects.
|
|
142
|
+
- 'stryker.config.*'
|
|
140
143
|
- 'stryker.conf.*'
|
|
141
144
|
- '.stryker.conf.*'
|
|
142
145
|
- '.mutmut*'
|
|
143
146
|
- 'mutants/**'
|
|
144
|
-
|
|
147
|
+
# A committed harness that mutates and asserts is evidence too — and
|
|
148
|
+
# stronger evidence than a config file, which proves only that someone
|
|
149
|
+
# installed a tool. USA mutates every rule check and asserts its own
|
|
150
|
+
# fixture flips (tests/integration/auditor-mutation.test.ts, ~100
|
|
151
|
+
# probes in every CI run); no third-party tool name appears anywhere in
|
|
152
|
+
# the repo, so the tool-only globs scored that work as absent.
|
|
153
|
+
- 'tests/**/*mutation*'
|
|
154
|
+
- 'tests/**/mutation/**'
|
|
155
|
+
why: 'Coverage tells you which lines ran, not whether the test would have failed if the line were wrong; a mutation config, report, or committed mutation harness proves the question was asked.'
|
|
145
156
|
remediation: 'Run mutation testing on the highest-risk module first and keep the config or report in the repo.'
|
|
146
157
|
references: ['Mutation-Testing']
|
|
147
158
|
|
|
@@ -178,7 +189,11 @@ rules:
|
|
|
178
189
|
class: operations
|
|
179
190
|
check:
|
|
180
191
|
kind: grep_present
|
|
181
|
-
|
|
192
|
+
# A declared budget of zero is a budget, and a stricter one than 2:
|
|
193
|
+
# the project has decided a flaky test is a failure, not a rerun. The
|
|
194
|
+
# earlier `[1-9]` required paying for retries, so the most honest
|
|
195
|
+
# answer a deterministic suite can give was scored as absent.
|
|
196
|
+
pattern: '(retr(?:y|ies)\s*:\s*\d|retries=\d|--retries[ =]\d|rerun-failed|flaky-test-retry|retry-on-failure)'
|
|
182
197
|
include:
|
|
183
198
|
[
|
|
184
199
|
'playwright.config.*',
|
|
@@ -190,8 +205,8 @@ rules:
|
|
|
190
205
|
'.github/workflows/*.yaml',
|
|
191
206
|
'.gitlab-ci.yml',
|
|
192
207
|
]
|
|
193
|
-
why: 'A
|
|
194
|
-
remediation: 'Declare
|
|
208
|
+
why: 'A declared retry budget says what the project does when a test fails twice: rerun it, or treat it as a defect. Either answer is a policy; silence means nobody decided.'
|
|
209
|
+
remediation: 'Declare the budget explicitly. Prefer retries: 0 and fix flakes; if reruns are unavoidable, set retries: 2 on CI only, track which tests consume it, and quarantine chronic consumers.'
|
|
195
210
|
references: ['Google-Testing-Blog:Flaky']
|
|
196
211
|
|
|
197
212
|
- id: TAS-010
|