@zerothreatai/vulnerability-registry 4.0.0 → 6.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.
Files changed (99) hide show
  1. package/dist/categories/authentication.js +17 -17
  2. package/dist/categories/configuration.js +80 -80
  3. package/dist/categories/injection.js +34 -34
  4. package/dist/categories/sensitive-paths.js +84 -84
  5. package/dist/categories/ssrf.js +11 -11
  6. package/dist/categories/xss.js +15 -15
  7. package/dist/compliance-codes.d.ts +207 -0
  8. package/dist/compliance-codes.js +213 -0
  9. package/dist/compliances/gdpr.d.ts +2 -0
  10. package/dist/compliances/gdpr.js +252 -0
  11. package/dist/compliances/helpers.d.ts +6 -0
  12. package/dist/compliances/helpers.js +11 -0
  13. package/dist/compliances/hipaa.d.ts +2 -0
  14. package/dist/compliances/hipaa.js +187 -0
  15. package/dist/compliances/index.d.ts +5 -0
  16. package/dist/compliances/index.js +5 -0
  17. package/dist/compliances/owasp.d.ts +2 -0
  18. package/dist/compliances/owasp.js +127 -0
  19. package/dist/compliances/pci-dss.d.ts +2 -0
  20. package/dist/compliances/pci-dss.js +260 -0
  21. package/dist/compliances/sans-top-25.d.ts +2 -0
  22. package/dist/compliances/sans-top-25.js +242 -0
  23. package/dist/index.d.ts +7 -1
  24. package/dist/index.js +7 -1
  25. package/dist/types.d.ts +33 -0
  26. package/dist/types.js +11 -1
  27. package/dist-cjs/categories/authentication.js +17 -17
  28. package/dist-cjs/categories/configuration.js +80 -80
  29. package/dist-cjs/categories/injection.js +34 -34
  30. package/dist-cjs/categories/sensitive-paths.js +84 -84
  31. package/dist-cjs/categories/ssrf.js +11 -11
  32. package/dist-cjs/categories/xss.js +15 -15
  33. package/dist-cjs/compliance-codes.js +216 -0
  34. package/dist-cjs/compliances/gdpr.js +255 -0
  35. package/dist-cjs/compliances/helpers.js +19 -0
  36. package/dist-cjs/compliances/hipaa.js +190 -0
  37. package/dist-cjs/compliances/index.js +13 -0
  38. package/dist-cjs/compliances/owasp.js +130 -0
  39. package/dist-cjs/compliances/pci-dss.js +263 -0
  40. package/dist-cjs/compliances/sans-top-25.js +245 -0
  41. package/dist-cjs/index.js +12 -1
  42. package/dist-cjs/types.js +12 -0
  43. package/package.json +40 -32
  44. package/scripts/assign-ids.ts +105 -0
  45. package/scripts/check-duplicate-ids.ts +45 -0
  46. package/src/categories/authentication.ts +17 -17
  47. package/src/categories/configuration.ts +80 -80
  48. package/src/categories/injection.ts +34 -34
  49. package/src/categories/sensitive-paths.ts +84 -84
  50. package/src/categories/ssrf.ts +11 -11
  51. package/src/categories/xss.ts +15 -15
  52. package/src/compliance-codes.ts +216 -0
  53. package/src/compliances/README.md +82 -0
  54. package/src/compliances/gdpr.ts +258 -0
  55. package/src/compliances/helpers.ts +29 -0
  56. package/src/compliances/hipaa.ts +193 -0
  57. package/src/compliances/index.ts +5 -0
  58. package/src/compliances/owasp.ts +133 -0
  59. package/src/compliances/pci-dss.ts +266 -0
  60. package/src/compliances/sans-top-25.ts +246 -0
  61. package/src/id-registry.json +1235 -0
  62. package/src/index.ts +12 -1
  63. package/src/types.ts +40 -4
  64. package/src/categories/authentication.d.ts +0 -8
  65. package/src/categories/authentication.d.ts.map +0 -1
  66. package/src/categories/authentication.js +0 -392
  67. package/src/categories/authentication.js.map +0 -1
  68. package/src/categories/configuration.d.ts +0 -8
  69. package/src/categories/configuration.d.ts.map +0 -1
  70. package/src/categories/configuration.js +0 -1782
  71. package/src/categories/configuration.js.map +0 -1
  72. package/src/categories/injection.d.ts +0 -8
  73. package/src/categories/injection.d.ts.map +0 -1
  74. package/src/categories/injection.js +0 -781
  75. package/src/categories/injection.js.map +0 -1
  76. package/src/categories/sensitive-paths.d.ts +0 -9
  77. package/src/categories/sensitive-paths.d.ts.map +0 -1
  78. package/src/categories/sensitive-paths.js +0 -1872
  79. package/src/categories/sensitive-paths.js.map +0 -1
  80. package/src/categories/ssrf.d.ts +0 -8
  81. package/src/categories/ssrf.d.ts.map +0 -1
  82. package/src/categories/ssrf.js +0 -258
  83. package/src/categories/ssrf.js.map +0 -1
  84. package/src/categories/xss.d.ts +0 -7
  85. package/src/categories/xss.d.ts.map +0 -1
  86. package/src/categories/xss.js +0 -340
  87. package/src/categories/xss.js.map +0 -1
  88. package/src/error-codes.d.ts +0 -280
  89. package/src/error-codes.d.ts.map +0 -1
  90. package/src/error-codes.js +0 -350
  91. package/src/error-codes.js.map +0 -1
  92. package/src/index.d.ts +0 -60
  93. package/src/index.d.ts.map +0 -1
  94. package/src/index.js +0 -92
  95. package/src/index.js.map +0 -1
  96. package/src/types.d.ts +0 -88
  97. package/src/types.d.ts.map +0 -1
  98. package/src/types.js +0 -6
  99. package/src/types.js.map +0 -1
@@ -0,0 +1,105 @@
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+
4
+ const ROOT = path.resolve("D:/new-git-project/agents/shared/vulnerability-registry");
5
+ const CATEGORIES_DIR = path.join(ROOT, "src", "categories");
6
+ const REGISTRY_PATH = path.join(ROOT, "src", "id-registry.json");
7
+
8
+ const RANGES: Record<string, [number, number]> = {
9
+ authentication: [100, 199],
10
+ configuration: [200, 299],
11
+ injection: [300, 399],
12
+ xss: [400, 449],
13
+ ssrf: [450, 499],
14
+ "sensitive-paths": [500, 699],
15
+ };
16
+
17
+ const CODE_PATTERN = /\[VulnerabilityCode\.([A-Z0-9_]+)\]\s*:/g;
18
+ const ID_PATTERN = /\bid\s*:\s*(\d+)/;
19
+
20
+ type AssignedEntry = {
21
+ code: string;
22
+ category: string;
23
+ id: number;
24
+ };
25
+
26
+ function assignIdsForFile(filePath: string, category: string): { text: string; entries: AssignedEntry[] } {
27
+ const text = fs.readFileSync(filePath, "utf-8");
28
+ const matches = Array.from(text.matchAll(CODE_PATTERN));
29
+ if (matches.length === 0) {
30
+ return { text, entries: [] };
31
+ }
32
+
33
+ const [startId, endId] = RANGES[category];
34
+ let nextId = startId;
35
+ const entries: AssignedEntry[] = [];
36
+ const outParts: string[] = [];
37
+ let cursor = 0;
38
+
39
+ for (let i = 0; i < matches.length; i += 1) {
40
+ const match = matches[i];
41
+ const blockStart = match.index! + match[0].length;
42
+ const blockEnd = i + 1 < matches.length ? matches[i + 1].index! : text.length;
43
+ const block = text.slice(blockStart, blockEnd);
44
+
45
+ const idMatch = ID_PATTERN.exec(block);
46
+ if (!idMatch) {
47
+ throw new Error(`Missing id field for ${match[1]} in ${filePath}`);
48
+ }
49
+ if (nextId > endId) {
50
+ throw new Error(`ID range exhausted for category ${category}`);
51
+ }
52
+
53
+ const newBlock =
54
+ block.slice(0, idMatch.index) +
55
+ `id: ${nextId}` +
56
+ block.slice(idMatch.index + idMatch[0].length);
57
+
58
+ outParts.push(text.slice(cursor, blockStart));
59
+ outParts.push(newBlock);
60
+ cursor = blockEnd;
61
+
62
+ entries.push({
63
+ code: match[1],
64
+ category,
65
+ id: nextId,
66
+ });
67
+ nextId += 1;
68
+ }
69
+
70
+ outParts.push(text.slice(cursor));
71
+ return { text: outParts.join(""), entries };
72
+ }
73
+
74
+ function main(): void {
75
+ const allEntries: AssignedEntry[] = [];
76
+ const files: Array<[string, string]> = [
77
+ ["authentication.ts", "authentication"],
78
+ ["configuration.ts", "configuration"],
79
+ ["injection.ts", "injection"],
80
+ ["xss.ts", "xss"],
81
+ ["ssrf.ts", "ssrf"],
82
+ ["sensitive-paths.ts", "sensitive-paths"],
83
+ ];
84
+
85
+ for (const [fileName, category] of files) {
86
+ const filePath = path.join(CATEGORIES_DIR, fileName);
87
+ if (!fs.existsSync(filePath)) {
88
+ throw new Error(`Missing category file: ${filePath}`);
89
+ }
90
+ const { text, entries } = assignIdsForFile(filePath, category);
91
+ fs.writeFileSync(filePath, text);
92
+ allEntries.push(...entries);
93
+ }
94
+
95
+ const registry = {
96
+ ranges: Object.fromEntries(
97
+ Object.entries(RANGES).map(([key, value]) => [key, Array.from(value)])
98
+ ),
99
+ entries: allEntries,
100
+ };
101
+ fs.writeFileSync(REGISTRY_PATH, JSON.stringify(registry, null, 2));
102
+ console.log(`Wrote ${allEntries.length} entries to ${REGISTRY_PATH}`);
103
+ }
104
+
105
+ main();
@@ -0,0 +1,45 @@
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+
4
+ const ROOT = path.resolve("D:/new-git-project/agents/shared/vulnerability-registry");
5
+ const REGISTRY_PATH = path.join(ROOT, "src", "id-registry.json");
6
+
7
+ type RegistryEntry = {
8
+ id: number;
9
+ code: string;
10
+ };
11
+
12
+ function main(): void {
13
+ if (!fs.existsSync(REGISTRY_PATH)) {
14
+ throw new Error(`Missing registry file: ${REGISTRY_PATH}`);
15
+ }
16
+ const raw = fs.readFileSync(REGISTRY_PATH, "utf-8");
17
+ const data = JSON.parse(raw);
18
+ const entries: RegistryEntry[] = data.entries ?? [];
19
+
20
+ const seen = new Map<number, string>();
21
+ const duplicates = new Map<number, string[]>();
22
+
23
+ for (const entry of entries) {
24
+ if (seen.has(entry.id)) {
25
+ const existing = seen.get(entry.id)!;
26
+ const list = duplicates.get(entry.id) ?? [existing];
27
+ list.push(entry.code);
28
+ duplicates.set(entry.id, list);
29
+ } else {
30
+ seen.set(entry.id, entry.code);
31
+ }
32
+ }
33
+
34
+ if (duplicates.size > 0) {
35
+ const lines: string[] = [];
36
+ for (const [id, codes] of Array.from(duplicates.entries()).sort((a, b) => a[0] - b[0])) {
37
+ lines.push(`${id}: ${codes.join(", ")}`);
38
+ }
39
+ throw new Error(`Duplicate vulnerability IDs found:\n${lines.join("\n")}`);
40
+ }
41
+
42
+ console.log("OK: No duplicate vulnerability IDs in id-registry.json");
43
+ }
44
+
45
+ main();
@@ -12,7 +12,7 @@ export const AUTH_VULNERABILITIES: Record<string, VulnerabilityDefinition> = {
12
12
  // JWT VULNERABILITIES
13
13
  // ========================================
14
14
  [VulnerabilityCode.JWT_NONE_ALGORITHM]: {
15
- id: 57,
15
+ id: 100,
16
16
  code: VulnerabilityCode.JWT_NONE_ALGORITHM,
17
17
  title: 'JWT Vulnerability - None Algorithm Attack',
18
18
  description: 'Critical JWT vulnerability where the server accepts tokens with "alg": "none" in the header, allowing attackers to forge valid tokens without knowing the secret key by simply removing the signature and modifying claims to impersonate any user including administrators.',
@@ -35,7 +35,7 @@ export const AUTH_VULNERABILITIES: Record<string, VulnerabilityDefinition> = {
35
35
  },
36
36
 
37
37
  [VulnerabilityCode.JWT_WEAK_SECRET]: {
38
- id: 58,
38
+ id: 101,
39
39
  code: VulnerabilityCode.JWT_WEAK_SECRET,
40
40
  title: 'JWT Vulnerability - Weak Secret Key',
41
41
  description: 'JWT implementation using a weak or common secret key for HMAC signature verification that can be brute-forced or found in common secret dictionaries, allowing attackers to forge arbitrary valid tokens and bypass authentication to access any user account.',
@@ -58,7 +58,7 @@ export const AUTH_VULNERABILITIES: Record<string, VulnerabilityDefinition> = {
58
58
  },
59
59
 
60
60
  [VulnerabilityCode.JWT_KEY_CONFUSION]: {
61
- id: 59,
61
+ id: 102,
62
62
  code: VulnerabilityCode.JWT_KEY_CONFUSION,
63
63
  title: 'JWT Vulnerability - Algorithm Confusion Attack',
64
64
  description: 'JWT key confusion vulnerability where the server public key can be used as an HMAC secret by switching the algorithm from RS256 to HS256, allowing attackers to forge valid tokens using the publicly available key to generate valid HMAC signatures.',
@@ -84,7 +84,7 @@ export const AUTH_VULNERABILITIES: Record<string, VulnerabilityDefinition> = {
84
84
  // BROKEN ACCESS CONTROL
85
85
  // ========================================
86
86
  [VulnerabilityCode.BAC_ANONYMOUS_ACCESS]: {
87
- id: 60,
87
+ id: 103,
88
88
  code: VulnerabilityCode.BAC_ANONYMOUS_ACCESS,
89
89
  title: 'Broken Access Control - Anonymous Access',
90
90
  description: 'Critical broken access control vulnerability where authenticated endpoints can be accessed without any authentication by simply removing auth headers or cookies, exposing sensitive functionality and data to unauthenticated attackers without any credential requirement.',
@@ -107,7 +107,7 @@ export const AUTH_VULNERABILITIES: Record<string, VulnerabilityDefinition> = {
107
107
  },
108
108
 
109
109
  [VulnerabilityCode.BAC_IDOR]: {
110
- id: 61,
110
+ id: 104,
111
111
  code: VulnerabilityCode.BAC_IDOR,
112
112
  title: 'Broken Access Control - Insecure Direct Object Reference',
113
113
  description: 'IDOR vulnerability where users can access or modify resources belonging to other users by manipulating predictable identifiers like sequential IDs in URLs or request parameters, without proper authorization checks verifying resource ownership.',
@@ -130,7 +130,7 @@ export const AUTH_VULNERABILITIES: Record<string, VulnerabilityDefinition> = {
130
130
  },
131
131
 
132
132
  [VulnerabilityCode.BAC_VERTICAL_PRIVILEGE]: {
133
- id: 62,
133
+ id: 105,
134
134
  code: VulnerabilityCode.BAC_VERTICAL_PRIVILEGE,
135
135
  title: 'Broken Access Control - Vertical Privilege Escalation',
136
136
  description: 'Vertical privilege escalation vulnerability allowing regular users to access or perform administrative functions by directly accessing admin endpoints or manipulating role/permission parameters, bypassing role-based access controls to gain elevated privileges.',
@@ -156,7 +156,7 @@ export const AUTH_VULNERABILITIES: Record<string, VulnerabilityDefinition> = {
156
156
  // MASS ASSIGNMENT
157
157
  // ========================================
158
158
  [VulnerabilityCode.MASSASSIGN_ROLE_ESCALATION]: {
159
- id: 63,
159
+ id: 106,
160
160
  code: VulnerabilityCode.MASSASSIGN_ROLE_ESCALATION,
161
161
  title: 'Mass Assignment - Role Escalation',
162
162
  description: 'Mass assignment vulnerability allowing attackers to escalate privileges by including additional parameters like "role", "isAdmin", or "permissions" in requests that the application binds to user objects without proper allowlist filtering of settable fields.',
@@ -179,7 +179,7 @@ export const AUTH_VULNERABILITIES: Record<string, VulnerabilityDefinition> = {
179
179
  },
180
180
 
181
181
  [VulnerabilityCode.MASSASSIGN_PROTOTYPE_POLLUTION]: {
182
- id: 64,
182
+ id: 107,
183
183
  code: VulnerabilityCode.MASSASSIGN_PROTOTYPE_POLLUTION,
184
184
  title: 'Mass Assignment - Prototype Pollution',
185
185
  description: 'JavaScript prototype pollution vulnerability through mass assignment where attackers inject __proto__ or constructor.prototype properties that modify the Object prototype globally, potentially leading to denial of service, security bypass, or remote code execution.',
@@ -202,7 +202,7 @@ export const AUTH_VULNERABILITIES: Record<string, VulnerabilityDefinition> = {
202
202
  },
203
203
 
204
204
  [VulnerabilityCode.JWT_EXPIRED_TOKEN]: {
205
- id: 65,
205
+ id: 108,
206
206
  code: VulnerabilityCode.JWT_EXPIRED_TOKEN,
207
207
  title: 'JWT Vulnerability - Expired Token Accepted',
208
208
  description: 'JWT implementation does not properly validate token expiration (exp claim), accepting expired tokens that should be rejected. This allows attackers with previously captured tokens to reuse them indefinitely, maintaining unauthorized access without credential updates.',
@@ -225,7 +225,7 @@ export const AUTH_VULNERABILITIES: Record<string, VulnerabilityDefinition> = {
225
225
  },
226
226
 
227
227
  [VulnerabilityCode.JWT_MISSING_CLAIMS]: {
228
- id: 66,
228
+ id: 109,
229
229
  code: VulnerabilityCode.JWT_MISSING_CLAIMS,
230
230
  title: 'JWT Vulnerability - Missing Required Claims',
231
231
  description: 'JWT tokens are missing critical security claims like exp (expiration), iat (issued at), nbf (not before), or iss (issuer), reducing the security guarantees of the token system and potentially allowing token reuse, replay attacks, or cross-tenant access.',
@@ -248,7 +248,7 @@ export const AUTH_VULNERABILITIES: Record<string, VulnerabilityDefinition> = {
248
248
  },
249
249
 
250
250
  [VulnerabilityCode.BAC_HORIZONTAL_PRIVILEGE]: {
251
- id: 67,
251
+ id: 110,
252
252
  code: VulnerabilityCode.BAC_HORIZONTAL_PRIVILEGE,
253
253
  title: 'Broken Access Control - Horizontal Privilege Escalation',
254
254
  description: 'Horizontal privilege escalation vulnerability where authenticated users can access data or perform actions belonging to other users at the same privilege level by manipulating user identifiers, object references, or session parameters without ownership verification.',
@@ -271,7 +271,7 @@ export const AUTH_VULNERABILITIES: Record<string, VulnerabilityDefinition> = {
271
271
  },
272
272
 
273
273
  [VulnerabilityCode.MASSASSIGN_HIDDEN_FIELD]: {
274
- id: 68,
274
+ id: 111,
275
275
  code: VulnerabilityCode.MASSASSIGN_HIDDEN_FIELD,
276
276
  title: 'Mass Assignment - Hidden Field Manipulation',
277
277
  description: 'Mass assignment vulnerability where attackers can modify hidden form fields or server-side computed values like price, discount, userId, or timestamp by including them in request bodies, bypassing UI restrictions to manipulate business logic or data integrity.',
@@ -294,7 +294,7 @@ export const AUTH_VULNERABILITIES: Record<string, VulnerabilityDefinition> = {
294
294
  },
295
295
 
296
296
  [VulnerabilityCode.JWT_CLAIM_TAMPERING]: {
297
- id: 131,
297
+ id: 112,
298
298
  code: VulnerabilityCode.JWT_CLAIM_TAMPERING,
299
299
  title: 'JWT - Claim Tampering',
300
300
  description: 'JWT claim tampering vulnerability where attackers can modify token claims such as roles, user IDs, or permissions and the server accepts the tampered token, enabling privilege escalation or unauthorized access.',
@@ -317,7 +317,7 @@ export const AUTH_VULNERABILITIES: Record<string, VulnerabilityDefinition> = {
317
317
  },
318
318
 
319
319
  [VulnerabilityCode.JWT_KID_INJECTION]: {
320
- id: 132,
320
+ id: 113,
321
321
  code: VulnerabilityCode.JWT_KID_INJECTION,
322
322
  title: 'JWT - KID Header Injection',
323
323
  description: 'JWT key identifier (kid) injection vulnerability where attackers manipulate the kid header to influence key selection or file paths, potentially bypassing signature verification or loading attacker-controlled keys.',
@@ -340,7 +340,7 @@ export const AUTH_VULNERABILITIES: Record<string, VulnerabilityDefinition> = {
340
340
  },
341
341
 
342
342
  [VulnerabilityCode.JWT_JKU_INJECTION]: {
343
- id: 133,
343
+ id: 114,
344
344
  code: VulnerabilityCode.JWT_JKU_INJECTION,
345
345
  title: 'JWT - JKU Header Injection',
346
346
  description: 'JWT JKU (JWK Set URL) header injection vulnerability where attackers can control the URL used to fetch signing keys, allowing them to supply their own keys and forge valid tokens.',
@@ -363,7 +363,7 @@ export const AUTH_VULNERABILITIES: Record<string, VulnerabilityDefinition> = {
363
363
  },
364
364
 
365
365
  [VulnerabilityCode.JWT_EMBEDDED_JWK]: {
366
- id: 134,
366
+ id: 115,
367
367
  code: VulnerabilityCode.JWT_EMBEDDED_JWK,
368
368
  title: 'JWT - Embedded JWK Injection',
369
369
  description: 'JWT embedded JWK vulnerability where attackers include their own JWK in the token header and the server accepts it as a trusted signing key, enabling forged tokens and authentication bypass.',
@@ -386,7 +386,7 @@ export const AUTH_VULNERABILITIES: Record<string, VulnerabilityDefinition> = {
386
386
  },
387
387
 
388
388
  [VulnerabilityCode.JWT_X5C_INJECTION]: {
389
- id: 135,
389
+ id: 116,
390
390
  code: VulnerabilityCode.JWT_X5C_INJECTION,
391
391
  title: 'JWT - X5C Header Injection',
392
392
  description: 'JWT x5c header injection vulnerability where attackers provide an untrusted certificate chain, allowing them to influence key selection or bypass signature validation if certificate trust is not strictly enforced.',