Debian Codegraph @

tap-snapshots/test/lib/commands/audit.js.test.cjs

raw
1 /* IMPORTANT
2 * This snapshot file is auto-generated, but designed for humans.
3 * It should be checked into source control and tracked carefully.
4 * Re-generate by setting TAP_SNAPSHOT=1 and running tests.
5 * Make sure to inspect the output below. Do not ignore changes!
6 */
7 'use strict'
8 exports[`test/lib/commands/audit.js TAP audit fix - bulk endpoint > lockfile has [email protected] 1`] = `
9 {
10 "name": "test-dep",
11 "version": "1.0.0",
12 "lockfileVersion": 2,
13 "requires": true,
14 "packages": {
15 "": {
16 "name": "test-dep",
17 "version": "1.0.0",
18 "dependencies": {
19 "test-dep-a": "*"
20 }
21 },
22 "node_modules/test-dep-a": {
23 "version": "1.0.1",
24 "resolved": "https://registry.npmjs.org/test-dep-a/-/test-dep-a-1.0.1.tgz"
25 }
26 },
27 "dependencies": {
28 "test-dep-a": {
29 "version": "1.0.1",
30 "resolved": "https://registry.npmjs.org/test-dep-a/-/test-dep-a-1.0.1.tgz"
31 }
32 }
33 }
34
35 `
36
37 exports[`test/lib/commands/audit.js TAP audit fix - bulk endpoint > must match snapshot 1`] = `
38
39 added 1 package, and audited 2 packages in xxx
40
41 found 0 vulnerabilities
42 `
43
44 exports[`test/lib/commands/audit.js TAP audit signatures ignores optional dependencies > must match snapshot 1`] = `
45 audited 1 package in xxx
46
47 1 package has a verified registry signature
48 `
49
50 exports[`test/lib/commands/audit.js TAP audit signatures json output with invalid and missing signatures > must match snapshot 1`] = `
51 {
52 "invalid": [
53 {
54 "code": "EINTEGRITYSIGNATURE",
55 "message": "[email protected] has an invalid registry signature with keyid: SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA and signature: bogus",
56 "integrity": "sha512-QqZ7VJ/8xPkS9s2IWB7Shj3qTJdcRyeXKbPQnsZjsPEwvutGv0EGeVchPcauoiDFJlGbZMFq5GDCurAGNSghJQ==",
57 "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
58 "location": "node_modules/kms-demo",
59 "name": "kms-demo",
60 "registry": "https://registry.npmjs.org/",
61 "resolved": "https://registry.npmjs.org/kms-demo/-/kms-demo-1.0.0.tgz",
62 "signature": "bogus",
63 "type": "dependencies",
64 "version": "1.0.0"
65 }
66 ],
67 "missing": [
68 {
69 "location": "node_modules/async",
70 "name": "async",
71 "registry": "https://registry.npmjs.org/",
72 "resolved": "https://registry.npmjs.org/async/-/async-1.1.1.tgz",
73 "version": "1.1.1"
74 }
75 ]
76 }
77 `
78
79 exports[`test/lib/commands/audit.js TAP audit signatures json output with invalid attestations > must match snapshot 1`] = `
80 {
81 "invalid": [
82 {
83 "code": "EATTESTATIONVERIFY",
84 "message": "[email protected] failed to verify attestation: artifact signature verification failed",
85 "integrity": "sha512-e+qfbn/zf1+rCza/BhIA//Awmf0v1pa5HQS8Xk8iXrn9bgytytVLqYD0P7NSqZ6IELTgq+tcDvLPkQjNHyWLNg==",
86 "keyid": "",
87 "location": "node_modules/sigstore",
88 "name": "sigstore",
89 "registry": "https://registry.npmjs.org/",
90 "resolved": "https://registry.npmjs.org/sigstore/-/sigstore-1.0.0.tgz",
91 "signature": "MEYCIQD10kAn3lC/1rJvXBtSDckbqkKEmz369gPDKb4lG4zMKQIhAP1+RhbMcASsfXhxpXKNCAjJb+3Av3Br95eKD7VL/BEB",
92 "predicateType": "https://slsa.dev/provenance/v0.2",
93 "type": "dependencies",
94 "version": "1.0.0"
95 }
96 ],
97 "missing": []
98 }
99 `
100
101 exports[`test/lib/commands/audit.js TAP audit signatures json output with invalid signatures > must match snapshot 1`] = `
102 {
103 "invalid": [
104 {
105 "code": "EINTEGRITYSIGNATURE",
106 "message": "[email protected] has an invalid registry signature with keyid: SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA and signature: bogus",
107 "integrity": "sha512-QqZ7VJ/8xPkS9s2IWB7Shj3qTJdcRyeXKbPQnsZjsPEwvutGv0EGeVchPcauoiDFJlGbZMFq5GDCurAGNSghJQ==",
108 "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
109 "location": "node_modules/kms-demo",
110 "name": "kms-demo",
111 "registry": "https://registry.npmjs.org/",
112 "resolved": "https://registry.npmjs.org/kms-demo/-/kms-demo-1.0.0.tgz",
113 "signature": "bogus",
114 "type": "dependencies",
115 "version": "1.0.0"
116 }
117 ],
118 "missing": []
119 }
120 `
121
122 exports[`test/lib/commands/audit.js TAP audit signatures json output with valid signatures > must match snapshot 1`] = `
123 {
124 "invalid": [],
125 "missing": []
126 }
127 `
128
129 exports[`test/lib/commands/audit.js TAP audit signatures multiple registries with keys and signatures > must match snapshot 1`] = `
130 audited 2 packages in xxx
131
132 2 packages have verified registry signatures
133 `
134
135 exports[`test/lib/commands/audit.js TAP audit signatures omit dev dependencies with missing signature > must match snapshot 1`] = `
136 audited 1 package in xxx
137
138 1 package has a verified registry signature
139 `
140
141 exports[`test/lib/commands/audit.js TAP audit signatures output details about missing signatures > must match snapshot 1`] = `
142 audited 1 package in xxx
143
144 1 package has a missing registry signature but the registry is providing signing keys:
145
146 [email protected] (https://registry.npmjs.org/)
147 `
148
149 exports[`test/lib/commands/audit.js TAP audit signatures third-party registry with invalid signatures errors > must match snapshot 1`] = `
150 audited 1 package in xxx
151
152 1 package has an invalid registry signature:
153
154 @npmcli/[email protected] (https://verdaccio-clone.org/)
155
156 Someone might have tampered with this package since it was published on the registry!
157 `
158
159 exports[`test/lib/commands/audit.js TAP audit signatures third-party registry with keys and missing signatures errors > must match snapshot 1`] = `
160 audited 1 package in xxx
161
162 1 package has a missing registry signature but the registry is providing signing keys:
163
164 @npmcli/[email protected] (https://verdaccio-clone.org/)
165 `
166
167 exports[`test/lib/commands/audit.js TAP audit signatures third-party registry with keys and signatures > must match snapshot 1`] = `
168 audited 1 package in xxx
169
170 1 package has a verified registry signature
171 `
172
173 exports[`test/lib/commands/audit.js TAP audit signatures third-party registry with sub-path (trailing slash) > must match snapshot 1`] = `
174 audited 1 package in xxx
175
176 1 package has a verified registry signature
177 `
178
179 exports[`test/lib/commands/audit.js TAP audit signatures third-party registry with sub-path > must match snapshot 1`] = `
180 audited 1 package in xxx
181
182 1 package has a verified registry signature
183 `
184
185 exports[`test/lib/commands/audit.js TAP audit signatures with both invalid and missing signatures > must match snapshot 1`] = `
186 audited 2 packages in xxx
187
188 1 package has a missing registry signature but the registry is providing signing keys:
189
190 [email protected] (https://registry.npmjs.org/)
191
192 1 package has an invalid registry signature:
193
194 [email protected] (https://registry.npmjs.org/)
195
196 Someone might have tampered with this package since it was published on the registry!
197 `
198
199 exports[`test/lib/commands/audit.js TAP audit signatures with bundled and peer deps and no signatures > must match snapshot 1`] = `
200 audited 1 package in xxx
201
202 1 package has a verified registry signature
203 `
204
205 exports[`test/lib/commands/audit.js TAP audit signatures with invalid attestations > must match snapshot 1`] = `
206 audited 1 package in xxx
207
208 1 package has an invalid attestation:
209
210 [email protected] (https://registry.npmjs.org/)
211
212 Someone might have tampered with this package since it was published on the registry!
213 `
214
215 exports[`test/lib/commands/audit.js TAP audit signatures with invalid signatures > must match snapshot 1`] = `
216 audited 1 package in xxx
217
218 1 package has an invalid registry signature:
219
220 [email protected] (https://registry.npmjs.org/)
221
222 Someone might have tampered with this package since it was published on the registry!
223 `
224
225 exports[`test/lib/commands/audit.js TAP audit signatures with invalid signatures and color output enabled > must match snapshot 1`] = `
226 audited 1 package in xxx
227
228 1 package has an invalid registry signature:
229
230 [[email protected] (https://registry.npmjs.org/)
231
232 Someone might have tampered with this package since it was published on the registry!
233 `
234
235 exports[`test/lib/commands/audit.js TAP audit signatures with key fallback to legacy API > must match snapshot 1`] = `
236 audited 1 package in xxx
237
238 1 package has a verified registry signature
239 `
240
241 exports[`test/lib/commands/audit.js TAP audit signatures with keys but missing signature > must match snapshot 1`] = `
242 audited 1 package in xxx
243
244 1 package has a missing registry signature but the registry is providing signing keys:
245
246 [email protected] (https://registry.npmjs.org/)
247 `
248
249 exports[`test/lib/commands/audit.js TAP audit signatures with multiple invalid attestations > must match snapshot 1`] = `
250 audited 2 packages in xxx
251
252 2 packages have invalid attestations:
253
254 [email protected] (https://registry.npmjs.org/)
255 [email protected] (https://registry.npmjs.org/)
256
257 Someone might have tampered with these packages since they were published on the registry!
258 `
259
260 exports[`test/lib/commands/audit.js TAP audit signatures with multiple invalid signatures > must match snapshot 1`] = `
261 audited 2 packages in xxx
262
263 2 packages have invalid registry signatures:
264
265 [email protected] (https://registry.npmjs.org/)
266 [email protected] (https://registry.npmjs.org/)
267
268 Someone might have tampered with these packages since they were published on the registry!
269 `
270
271 exports[`test/lib/commands/audit.js TAP audit signatures with multiple missing signatures > must match snapshot 1`] = `
272 audited 2 packages in xxx
273
274 2 packages have missing registry signatures but the registry is providing signing keys:
275
276 [email protected] (https://registry.npmjs.org/)
277 [email protected] (https://registry.npmjs.org/)
278 `
279
280 exports[`test/lib/commands/audit.js TAP audit signatures with multiple valid signatures and one invalid > must match snapshot 1`] = `
281 audited 3 packages in xxx
282
283 2 packages have verified registry signatures
284
285 1 package has an invalid registry signature:
286
287 [email protected] (https://registry.npmjs.org/)
288
289 Someone might have tampered with this package since it was published on the registry!
290 `
291
292 exports[`test/lib/commands/audit.js TAP audit signatures with valid and missing signatures > must match snapshot 1`] = `
293 audited 2 packages in xxx
294
295 1 package has a verified registry signature
296
297 1 package has a missing registry signature but the registry is providing signing keys:
298
299 [email protected] (https://registry.npmjs.org/)
300 `
301
302 exports[`test/lib/commands/audit.js TAP audit signatures with valid attestations > must match snapshot 1`] = `
303 audited 1 package in xxx
304
305 1 package has a verified registry signature
306
307 1 package has a verified attestation
308 (use --json --include-attestations to view attestation details)
309 `
310
311 exports[`test/lib/commands/audit.js TAP audit signatures with valid signatures > must match snapshot 1`] = `
312 audited 1 package in xxx
313
314 1 package has a verified registry signature
315 `
316
317 exports[`test/lib/commands/audit.js TAP audit signatures with valid signatures using alias > must match snapshot 1`] = `
318 audited 1 package in xxx
319
320 1 package has a verified registry signature
321 `
322
323 exports[`test/lib/commands/audit.js TAP audit signatures workspaces verifies registry deps and ignores local workspace deps > must match snapshot 1`] = `
324 audited 3 packages in xxx
325
326 3 packages have verified registry signatures
327 `
328
329 exports[`test/lib/commands/audit.js TAP audit signatures workspaces verifies registry deps when filtering by workspace name > must match snapshot 1`] = `
330 audited 2 packages in xxx
331
332 2 packages have verified registry signatures
333 `
334
335 exports[`test/lib/commands/audit.js TAP json audit > must match snapshot 1`] = `
336 {
337 "auditReportVersion": 2,
338 "vulnerabilities": {
339 "test-dep-a": {
340 "name": "test-dep-a",
341 "severity": "high",
342 "isDirect": true,
343 "via": [
344 {
345 "source": 100,
346 "name": "test-dep-a",
347 "dependency": "test-dep-a",
348 "title": "Test advisory 100",
349 "url": "https://github.com/advisories/GHSA-100",
350 "severity": "high",
351 "cwe": [
352 "cwe-0"
353 ],
354 "cvss": {
355 "score": 0
356 },
357 "range": "*"
358 }
359 ],
360 "effects": [],
361 "range": "*",
362 "nodes": [
363 "node_modules/test-dep-a"
364 ],
365 "fixAvailable": false
366 }
367 },
368 "metadata": {
369 "vulnerabilities": {
370 "info": 0,
371 "low": 0,
372 "moderate": 0,
373 "high": 1,
374 "critical": 0,
375 "total": 1
376 },
377 "dependencies": {
378 "prod": 2,
379 "dev": 0,
380 "optional": 0,
381 "peer": 0,
382 "peerOptional": 0,
383 "total": 1
384 }
385 }
386 }
387 `
388
389 exports[`test/lib/commands/audit.js TAP normal audit > must match snapshot 1`] = `
390 # npm audit report
391
392 test-dep-a 1.0.0
393 Severity: high
394 Test advisory 100 - https://github.com/advisories/GHSA-100
395 fix available via \`npm audit fix\`
396 node_modules/test-dep-a
397
398 1 high severity vulnerability
399
400 To address all issues, run:
401 npm audit fix
402 `