@knime/utils 1.12.0 → 2.0.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/audit/README.md DELETED
@@ -1,118 +0,0 @@
1
- # pnpm Bulk Audit
2
-
3
- A workaround for `pnpm audit` failing with HTTP 410 after npm retired the legacy
4
- audit endpoints. This tool calls the replacement
5
- [bulk advisory endpoint](https://api-docs.npmjs.com/#tag/Audit) directly.
6
-
7
- **Background:** In April 2026 npm retired `/-/npm/v1/security/audits` (and the
8
- `/quick` variant). `pnpm audit` on all 10.x and early 11.x versions is broken
9
- because it still calls the old endpoints. See
10
- [pnpm/pnpm#11265](https://github.com/pnpm/pnpm/issues/11265). This tool bridges
11
- the gap until pnpm ships a fix.
12
-
13
- ## Quick start
14
-
15
- Add `@knime/utils` as a dev dependency (it is already present in the monorepo),
16
- then call the binary directly:
17
-
18
- ```jsonc
19
- // package.json
20
- {
21
- "scripts": {
22
- "audit": "pnpm-bulk-audit",
23
- },
24
- "devDependencies": {
25
- "@knime/utils": "workspace:*",
26
- },
27
- }
28
- ```
29
-
30
- Then run:
31
-
32
- ```bash
33
- pnpm run audit
34
- ```
35
-
36
- ## CLI options
37
-
38
- ```
39
- Usage: pnpm-bulk-audit [options]
40
-
41
- Options:
42
- --lockfile <path> Path to pnpm-lock.yaml (default: ./pnpm-lock.yaml)
43
- --registry <url> npm registry URL (default: https://registry.npmjs.org)
44
- --severity <level> Minimum severity: low, moderate, high, critical (default: low)
45
- --prod, -P Only report vulnerabilities in production dependencies
46
- --json Output raw JSON
47
- --no-ignore Skip reading ignoreCves/ignoreGhsas from config
48
- --help, -h Show this help
49
- ```
50
-
51
- ## Prod vs dev classification
52
-
53
- Each vulnerability is annotated with `[prod]` or `[dev]` based on whether the
54
- affected package is reachable from any importer's `dependencies` (as opposed to
55
- `devDependencies`). The classifier walks the full dependency graph in the
56
- lockfile, following workspace links transitively.
57
-
58
- Use `--prod` (or `-P`) to only report vulnerabilities in production
59
- dependencies.
60
-
61
- ## Ignore lists
62
-
63
- The tool reads `auditConfig.ignoreCves` and `auditConfig.ignoreGhsas` from two
64
- places (both are merged):
65
-
66
- ### pnpm-workspace.yaml
67
-
68
- ```yaml
69
- auditConfig:
70
- ignoreCves:
71
- - CVE-2026-4800
72
- ignoreGhsas:
73
- - GHSA-78h3-pg4x-j8cv
74
- ```
75
-
76
- ### package.json
77
-
78
- ```jsonc
79
- {
80
- "pnpm": {
81
- "auditConfig": {
82
- "ignoreCves": ["CVE-2026-4800"],
83
- "ignoreGhsas": ["GHSA-78h3-pg4x-j8cv"],
84
- },
85
- },
86
- }
87
- ```
88
-
89
- **GHSA IDs** are matched directly from the advisory URL returned by the npm
90
- registry.
91
- **CVE IDs** require an extra lookup via the GitHub advisories API
92
- (`api.github.com/advisories/{ghsa}`) because the npm bulk endpoint does not
93
- include CVE identifiers in its response.
94
-
95
- Use `--no-ignore` to skip all ignore-list processing.
96
-
97
- ## Programmatic usage
98
-
99
- ```ts
100
- import { audit, formatAuditReport, readAuditConfig } from "@knime/utils/audit";
101
-
102
- const config = readAuditConfig(".");
103
- const result = await audit({
104
- lockfilePath: "./pnpm-lock.yaml",
105
- minSeverity: "high",
106
- auditConfig: config,
107
- });
108
- console.log(formatAuditReport(result));
109
- ```
110
-
111
- ## How it works
112
-
113
- 1. Parses the `packages:` section of `pnpm-lock.yaml` to extract every
114
- `name@version` pair.
115
- 2. POSTs them as `{ "pkg": ["version", …] }` to the npm bulk advisory endpoint
116
- (`/-/npm/v1/security/advisories/bulk`).
117
- 3. Filters the response by severity and ignore lists.
118
- 4. Exits with code 1 if any vulnerabilities remain, 0 otherwise.