verdaccio-security-filter 1.4.3 → 1.4.4

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/README.md CHANGED
@@ -433,7 +433,7 @@ Recommended before turning on `cveCheck.autoBlock`, a license policy or the auth
433
433
  |--------|------|---------|-------------|
434
434
  | `cveCheck.enabled` | `boolean` | `false` | Enable CVE scanning |
435
435
  | `cveCheck.databases` | `string[]` | `['osv']` | Vulnerability databases. Only `osv` is implemented; it already includes GitHub Security Advisories |
436
- | `cveCheck.severity` | `string[]` | `['high', 'critical']` | Severity levels to check |
436
+ | `cveCheck.severity` | `string[]` | `['high', 'critical']` | Severity levels to act on. See [how severity is determined](#how-severity-is-determined) |
437
437
  | `cveCheck.autoBlock` | `boolean` | `false` | Remove vulnerable versions from metadata (whole package blocked if every version is vulnerable) |
438
438
  | `cveCheck.updateInterval` | `number` | `24` | How long a package's vulnerability data is cached (hours) |
439
439
  | `cveCheck.cacheDir` | `string` | `./.security-cache` | Cache directory path |
@@ -442,6 +442,18 @@ Recommended before turning on `cveCheck.autoBlock`, a license policy or the auth
442
442
 
443
443
  > **When OSV is unreachable:** a lookup gets one retry with a 5 second timeout each. After a failure the same package is not looked up again for 60 seconds. Previously cached data, even if older than `updateInterval`, keeps being used. With no cached data, `errorHandling.onCveCheckError` decides: `fail-open` serves the package unchecked, `fail-closed` blocks it.
444
444
 
445
+ ### How severity is determined
446
+
447
+ For each OSV record, in this order:
448
+
449
+ 1. Malicious-package reports (ids starting with `MAL-`) are `critical`. They carry no severity information in OSV.
450
+ 2. The rating of the source database (GitHub Security Advisories: `LOW`, `MODERATE`, `HIGH`, `CRITICAL`).
451
+ 3. The CVSS v3.0 / v3.1 base score computed from the vector.
452
+ 4. A record with only a CVSS v4 vector is treated as `high`: v4 vectors are not scored.
453
+ 5. A record with no severity information at all is `medium`.
454
+
455
+ Cached results keep the severity they were stored with until they are refreshed (`cveCheck.updateInterval`).
456
+
445
457
  ### License Options
446
458
 
447
459
  | Option | Type | Default | Description |
@@ -274,18 +274,22 @@ class CVEChecker {
274
274
  };
275
275
  }
276
276
  mapOSVSeverity(vuln) {
277
- var _a, _b, _c, _d;
278
- const databaseSeverity = this.mapDatabaseSpecificSeverity((_a = vuln === null || vuln === void 0 ? void 0 : vuln.database_specific) === null || _a === void 0 ? void 0 : _a.severity);
277
+ var _a, _b, _c, _d, _e;
278
+ if ((_a = vuln === null || vuln === void 0 ? void 0 : vuln.id) === null || _a === void 0 ? void 0 : _a.startsWith('MAL-')) {
279
+ return 'critical';
280
+ }
281
+ const databaseSeverity = this.mapDatabaseSpecificSeverity((_b = vuln === null || vuln === void 0 ? void 0 : vuln.database_specific) === null || _b === void 0 ? void 0 : _b.severity);
279
282
  if (databaseSeverity) {
280
283
  return databaseSeverity;
281
284
  }
282
- const cvssV3 = (_b = vuln === null || vuln === void 0 ? void 0 : vuln.severity) === null || _b === void 0 ? void 0 : _b.find(entry => entry.type === 'CVSS_V3');
285
+ const cvssV3 = (_c = vuln === null || vuln === void 0 ? void 0 : vuln.severity) === null || _c === void 0 ? void 0 : _c.find(entry => entry.type === 'CVSS_V3');
283
286
  const score = cvssV3 ? this.computeCVSSv3BaseScore(cvssV3.score) : null;
284
287
  if (score !== null) {
285
288
  return this.scoreToSeverity(score);
286
289
  }
287
- if ((_c = vuln === null || vuln === void 0 ? void 0 : vuln.severity) === null || _c === void 0 ? void 0 : _c.some(entry => entry.type === 'CVSS_V4')) {
288
- this.log.debug(`[CVE Checker] ${(_d = vuln.id) !== null && _d !== void 0 ? _d : 'unknown vulnerability'} only has a CVSS_V4 vector, which is not scored yet - defaulting severity to medium`);
290
+ if ((_d = vuln === null || vuln === void 0 ? void 0 : vuln.severity) === null || _d === void 0 ? void 0 : _d.some(entry => entry.type === 'CVSS_V4')) {
291
+ this.log.debug(`[CVE Checker] ${(_e = vuln.id) !== null && _e !== void 0 ? _e : 'unknown vulnerability'} only has a CVSS_V4 vector, which is not scored - treating it as high`);
292
+ return 'high';
289
293
  }
290
294
  return 'medium';
291
295
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "verdaccio-security-filter",
3
- "version": "1.4.3",
3
+ "version": "1.4.4",
4
4
  "description": "Advanced security filter plugin for Verdaccio with version range blocking and fallback strategies",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",