@zerothreatai/vulnerability-registry 3.0.0 → 5.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/dist/categories/authentication.js +34 -17
- package/dist/categories/configuration.js +561 -60
- package/dist/categories/injection.js +68 -34
- package/dist/categories/sensitive-paths.js +168 -84
- package/dist/categories/ssrf.js +22 -11
- package/dist/categories/xss.js +30 -15
- package/dist/category.d.ts +6 -0
- package/dist/category.js +15 -0
- package/dist/error-codes.d.ts +20 -0
- package/dist/error-codes.js +20 -0
- package/dist/index.d.ts +9 -1
- package/dist/index.js +5 -1
- package/dist/scanner.d.ts +6 -0
- package/dist/scanner.js +22 -0
- package/dist/types.d.ts +2 -0
- package/dist-cjs/categories/authentication.js +34 -17
- package/dist-cjs/categories/configuration.js +561 -60
- package/dist-cjs/categories/injection.js +68 -34
- package/dist-cjs/categories/sensitive-paths.js +168 -84
- package/dist-cjs/categories/ssrf.js +22 -11
- package/dist-cjs/categories/xss.js +30 -15
- package/dist-cjs/category.js +18 -0
- package/dist-cjs/error-codes.js +20 -0
- package/dist-cjs/index.js +7 -1
- package/dist-cjs/scanner.js +25 -0
- package/package.json +35 -32
- package/scripts/assign-ids.ts +105 -0
- package/scripts/check-duplicate-ids.ts +45 -0
- package/src/categories/authentication.ts +145 -128
- package/src/categories/configuration.ts +1632 -1111
- package/src/categories/injection.ts +158 -124
- package/src/categories/sensitive-paths.ts +168 -84
- package/src/categories/ssrf.ts +22 -11
- package/src/categories/xss.ts +30 -15
- package/src/category.ts +16 -0
- package/src/error-codes.ts +25 -5
- package/src/id-registry.json +1235 -0
- package/src/index.ts +20 -14
- package/src/scanner.ts +23 -0
- package/src/types.ts +4 -2
- package/zerothreatai-vulnerability-registry-4npm .0.0.tgz +0 -0
- package/src/categories/authentication.d.ts +0 -8
- package/src/categories/authentication.d.ts.map +0 -1
- package/src/categories/authentication.js +0 -378
- package/src/categories/authentication.js.map +0 -1
- package/src/categories/configuration.d.ts +0 -8
- package/src/categories/configuration.d.ts.map +0 -1
- package/src/categories/configuration.js +0 -906
- package/src/categories/configuration.js.map +0 -1
- package/src/categories/injection.d.ts +0 -8
- package/src/categories/injection.d.ts.map +0 -1
- package/src/categories/injection.js +0 -750
- package/src/categories/injection.js.map +0 -1
- package/src/categories/sensitive-paths.d.ts +0 -9
- package/src/categories/sensitive-paths.d.ts.map +0 -1
- package/src/categories/sensitive-paths.js +0 -1791
- package/src/categories/sensitive-paths.js.map +0 -1
- package/src/categories/ssrf.d.ts +0 -8
- package/src/categories/ssrf.d.ts.map +0 -1
- package/src/categories/ssrf.js +0 -250
- package/src/categories/ssrf.js.map +0 -1
- package/src/categories/xss.d.ts +0 -7
- package/src/categories/xss.d.ts.map +0 -1
- package/src/categories/xss.js +0 -328
- package/src/categories/xss.js.map +0 -1
- package/src/error-codes.d.ts +0 -242
- package/src/error-codes.d.ts.map +0 -1
- package/src/error-codes.js +0 -315
- package/src/error-codes.js.map +0 -1
- package/src/index.d.ts +0 -60
- package/src/index.d.ts.map +0 -1
- package/src/index.js +0 -107
- package/src/index.js.map +0 -1
- package/src/types.d.ts +0 -86
- package/src/types.d.ts.map +0 -1
- package/src/types.js +0 -7
- package/src/types.js.map +0 -1
|
@@ -9,11 +9,12 @@ exports.SSRF_VULNERABILITIES = void 0;
|
|
|
9
9
|
const error_codes_js_1 = require("../error-codes.js");
|
|
10
10
|
exports.SSRF_VULNERABILITIES = {
|
|
11
11
|
[error_codes_js_1.VulnerabilityCode.SSRF_CLOUD_METADATA]: {
|
|
12
|
-
id:
|
|
12
|
+
id: 450,
|
|
13
13
|
code: error_codes_js_1.VulnerabilityCode.SSRF_CLOUD_METADATA,
|
|
14
14
|
title: 'Server-Side Request Forgery - Cloud Metadata Access',
|
|
15
15
|
description: 'Critical SSRF vulnerability enabling access to cloud provider metadata services (AWS IMDSv1, GCP, Azure) which expose sensitive information including IAM credentials, API tokens, and instance configuration that can lead to full cloud account compromise and lateral movement.',
|
|
16
16
|
severity: 'critical',
|
|
17
|
+
levelId: 1,
|
|
17
18
|
category: 'ssrf',
|
|
18
19
|
scanner: 'ssrf',
|
|
19
20
|
cvss: {
|
|
@@ -30,11 +31,12 @@ exports.SSRF_VULNERABILITIES = {
|
|
|
30
31
|
remediation: 'Block access to cloud metadata IP ranges (169.254.169.254). Implement IMDSv2 which requires tokens. Use allowlist for external URLs. Validate and sanitize all URL inputs.',
|
|
31
32
|
},
|
|
32
33
|
[error_codes_js_1.VulnerabilityCode.SSRF_INTERNAL_SERVICE]: {
|
|
33
|
-
id:
|
|
34
|
+
id: 451,
|
|
34
35
|
code: error_codes_js_1.VulnerabilityCode.SSRF_INTERNAL_SERVICE,
|
|
35
36
|
title: 'Server-Side Request Forgery - Internal Service Access',
|
|
36
37
|
description: 'SSRF vulnerability allowing attackers to access internal network services that should not be reachable from the internet, including databases, admin panels, cache servers, and other infrastructure components protected only by network segmentation without authentication.',
|
|
37
38
|
severity: 'high',
|
|
39
|
+
levelId: 2,
|
|
38
40
|
category: 'ssrf',
|
|
39
41
|
scanner: 'ssrf',
|
|
40
42
|
cvss: {
|
|
@@ -51,11 +53,12 @@ exports.SSRF_VULNERABILITIES = {
|
|
|
51
53
|
remediation: 'Implement URL allowlist for permitted external resources. Block requests to private IP ranges and localhost. Use network segmentation with proper authentication for internal services.',
|
|
52
54
|
},
|
|
53
55
|
[error_codes_js_1.VulnerabilityCode.SSRF_PROTOCOL_SMUGGLING]: {
|
|
54
|
-
id:
|
|
56
|
+
id: 452,
|
|
55
57
|
code: error_codes_js_1.VulnerabilityCode.SSRF_PROTOCOL_SMUGGLING,
|
|
56
58
|
title: 'Server-Side Request Forgery - Protocol Smuggling',
|
|
57
59
|
description: 'SSRF vulnerability exploiting non-HTTP protocol handlers like file://, gopher://, dict://, or ftp:// to read local files, interact with internal services using raw TCP, or perform attacks that would not be possible through HTTP requests alone, significantly expanding impact scope.',
|
|
58
60
|
severity: 'high',
|
|
61
|
+
levelId: 2,
|
|
59
62
|
category: 'ssrf',
|
|
60
63
|
scanner: 'ssrf',
|
|
61
64
|
cvss: {
|
|
@@ -72,11 +75,12 @@ exports.SSRF_VULNERABILITIES = {
|
|
|
72
75
|
remediation: 'Enforce HTTP/HTTPS only for outbound requests. Disable or block dangerous protocol handlers at the application and network level. Validate URL schemes against strict allowlist.',
|
|
73
76
|
},
|
|
74
77
|
[error_codes_js_1.VulnerabilityCode.SSRF_BLIND_OOB]: {
|
|
75
|
-
id:
|
|
78
|
+
id: 453,
|
|
76
79
|
code: error_codes_js_1.VulnerabilityCode.SSRF_BLIND_OOB,
|
|
77
80
|
title: 'Server-Side Request Forgery - Blind OOB',
|
|
78
81
|
description: 'Blind SSRF vulnerability confirmed through out-of-band DNS or HTTP callbacks indicating the server makes requests to attacker-controlled destinations even though responses are not reflected, enabling internal network scanning and data exfiltration through DNS or timing side channels.',
|
|
79
82
|
severity: 'medium',
|
|
83
|
+
levelId: 3,
|
|
80
84
|
category: 'ssrf',
|
|
81
85
|
scanner: 'ssrf',
|
|
82
86
|
cvss: {
|
|
@@ -96,11 +100,12 @@ exports.SSRF_VULNERABILITIES = {
|
|
|
96
100
|
// OPEN REDIRECT
|
|
97
101
|
// ========================================
|
|
98
102
|
[error_codes_js_1.VulnerabilityCode.REDIRECT_HEADER_INJECTION]: {
|
|
99
|
-
id:
|
|
103
|
+
id: 454,
|
|
100
104
|
code: error_codes_js_1.VulnerabilityCode.REDIRECT_HEADER_INJECTION,
|
|
101
105
|
title: 'Open Redirect - HTTP Header Injection',
|
|
102
106
|
description: 'Open redirect vulnerability through Location header manipulation allowing attackers to redirect victims to malicious websites after authenticating or interacting with the legitimate application, facilitating phishing attacks that abuse user trust in the original domain.',
|
|
103
107
|
severity: 'medium',
|
|
108
|
+
levelId: 3,
|
|
104
109
|
category: 'business_logic',
|
|
105
110
|
scanner: 'redirect-route',
|
|
106
111
|
cvss: {
|
|
@@ -117,11 +122,12 @@ exports.SSRF_VULNERABILITIES = {
|
|
|
117
122
|
remediation: 'Use allowlist of permitted redirect destinations. Avoid using user input for redirect URLs. If redirects are required, use indirect references or validate against known safe patterns.',
|
|
118
123
|
},
|
|
119
124
|
[error_codes_js_1.VulnerabilityCode.REDIRECT_JS_NAVIGATION]: {
|
|
120
|
-
id:
|
|
125
|
+
id: 455,
|
|
121
126
|
code: error_codes_js_1.VulnerabilityCode.REDIRECT_JS_NAVIGATION,
|
|
122
127
|
title: 'Open Redirect - JavaScript Navigation',
|
|
123
128
|
description: 'Client-side open redirect vulnerability through JavaScript navigation methods like window.location or location.href being set to user-controlled values, allowing attackers to redirect users to malicious sites through specially crafted URLs that bypass server-side validation.',
|
|
124
129
|
severity: 'medium',
|
|
130
|
+
levelId: 3,
|
|
125
131
|
category: 'business_logic',
|
|
126
132
|
scanner: 'redirect-route',
|
|
127
133
|
cvss: {
|
|
@@ -141,11 +147,12 @@ exports.SSRF_VULNERABILITIES = {
|
|
|
141
147
|
// HOST HEADER INJECTION
|
|
142
148
|
// ========================================
|
|
143
149
|
[error_codes_js_1.VulnerabilityCode.HOST_CACHE_POISONING]: {
|
|
144
|
-
id:
|
|
150
|
+
id: 456,
|
|
145
151
|
code: error_codes_js_1.VulnerabilityCode.HOST_CACHE_POISONING,
|
|
146
152
|
title: 'Host Header Injection - Cache Poisoning',
|
|
147
153
|
description: 'Host header injection vulnerability where manipulated Host headers are reflected in cached responses, allowing attackers to poison web caches and CDNs with malicious content that is then served to all users, potentially enabling widespread defacement or malware distribution.',
|
|
148
154
|
severity: 'high',
|
|
155
|
+
levelId: 2,
|
|
149
156
|
category: 'configuration',
|
|
150
157
|
scanner: 'host-header',
|
|
151
158
|
cvss: {
|
|
@@ -162,11 +169,12 @@ exports.SSRF_VULNERABILITIES = {
|
|
|
162
169
|
remediation: 'Configure web servers to reject requests with unexpected Host headers. Include Host header in cache keys. Use canonical URLs for all generated links.',
|
|
163
170
|
},
|
|
164
171
|
[error_codes_js_1.VulnerabilityCode.HOST_PASSWORD_RESET]: {
|
|
165
|
-
id:
|
|
172
|
+
id: 457,
|
|
166
173
|
code: error_codes_js_1.VulnerabilityCode.HOST_PASSWORD_RESET,
|
|
167
174
|
title: 'Host Header Injection - Password Reset Poisoning',
|
|
168
175
|
description: 'Critical host header injection vulnerability in password reset functionality where the injected Host header is used to generate password reset URLs, allowing attackers to receive password reset tokens when victims click the manipulated links in legitimate reset emails.',
|
|
169
176
|
severity: 'high',
|
|
177
|
+
levelId: 2,
|
|
170
178
|
category: 'configuration',
|
|
171
179
|
scanner: 'host-header',
|
|
172
180
|
cvss: {
|
|
@@ -183,11 +191,12 @@ exports.SSRF_VULNERABILITIES = {
|
|
|
183
191
|
remediation: 'Use hardcoded canonical domain for generated URLs. Never trust Host header for security-sensitive functionality. Validate Host header against configured allowed hosts.',
|
|
184
192
|
},
|
|
185
193
|
[error_codes_js_1.VulnerabilityCode.SSRF_FILTER_BYPASS]: {
|
|
186
|
-
id:
|
|
194
|
+
id: 458,
|
|
187
195
|
code: error_codes_js_1.VulnerabilityCode.SSRF_FILTER_BYPASS,
|
|
188
196
|
title: 'Server-Side Request Forgery - Filter Bypass',
|
|
189
197
|
description: 'SSRF vulnerability that bypasses security filters through encoding tricks (URL encoding, IPv6 representation, decimal IP notation), DNS rebinding, or using alternative representations of blocked addresses to reach internal resources despite URL validation controls.',
|
|
190
198
|
severity: 'high',
|
|
199
|
+
levelId: 2,
|
|
191
200
|
category: 'ssrf',
|
|
192
201
|
scanner: 'ssrf',
|
|
193
202
|
cvss: {
|
|
@@ -204,11 +213,12 @@ exports.SSRF_VULNERABILITIES = {
|
|
|
204
213
|
remediation: 'Implement defense-in-depth with multiple validation layers. Resolve DNS before validation. Use strict URL parsing libraries. Block all private IP ranges including encoded forms.',
|
|
205
214
|
},
|
|
206
215
|
[error_codes_js_1.VulnerabilityCode.REDIRECT_META_REFRESH]: {
|
|
207
|
-
id:
|
|
216
|
+
id: 459,
|
|
208
217
|
code: error_codes_js_1.VulnerabilityCode.REDIRECT_META_REFRESH,
|
|
209
218
|
title: 'Open Redirect - Meta Refresh',
|
|
210
219
|
description: 'Open redirect vulnerability through HTML meta refresh tags where user input controls the redirect target URL, enabling phishing attacks by sending victims to malicious sites after a brief delay on the legitimate domain, bypassing some security controls.',
|
|
211
220
|
severity: 'low',
|
|
221
|
+
levelId: 4,
|
|
212
222
|
category: 'business_logic',
|
|
213
223
|
scanner: 'redirect-route',
|
|
214
224
|
cvss: {
|
|
@@ -225,11 +235,12 @@ exports.SSRF_VULNERABILITIES = {
|
|
|
225
235
|
remediation: 'Validate meta refresh URLs against allowlist. Avoid using user input in meta refresh tags. Prefer server-side redirects with proper validation over client-side meta refresh.',
|
|
226
236
|
},
|
|
227
237
|
[error_codes_js_1.VulnerabilityCode.HOST_REDIRECT]: {
|
|
228
|
-
id:
|
|
238
|
+
id: 460,
|
|
229
239
|
code: error_codes_js_1.VulnerabilityCode.HOST_REDIRECT,
|
|
230
240
|
title: 'Host Header Injection - Open Redirect',
|
|
231
241
|
description: 'Host header injection leading to open redirect where the application uses the Host header to generate redirect URLs, allowing attackers to redirect users to malicious domains by manipulating the Host header in their requests.',
|
|
232
242
|
severity: 'medium',
|
|
243
|
+
levelId: 3,
|
|
233
244
|
category: 'configuration',
|
|
234
245
|
scanner: 'host-header',
|
|
235
246
|
cvss: {
|
|
@@ -9,11 +9,12 @@ exports.XSS_VULNERABILITIES = void 0;
|
|
|
9
9
|
const error_codes_js_1 = require("../error-codes.js");
|
|
10
10
|
exports.XSS_VULNERABILITIES = {
|
|
11
11
|
[error_codes_js_1.VulnerabilityCode.XSS_REFLECTED]: {
|
|
12
|
-
id:
|
|
12
|
+
id: 400,
|
|
13
13
|
code: error_codes_js_1.VulnerabilityCode.XSS_REFLECTED,
|
|
14
14
|
title: 'Cross-Site Scripting - Reflected',
|
|
15
15
|
description: 'Reflected XSS vulnerability where user input is immediately returned by the server in the response without proper encoding, allowing attackers to inject malicious scripts that execute in the victim browser when they click a crafted link or submit a manipulated form.',
|
|
16
16
|
severity: 'medium',
|
|
17
|
+
levelId: 3,
|
|
17
18
|
category: 'xss',
|
|
18
19
|
scanner: 'xss',
|
|
19
20
|
cvss: {
|
|
@@ -30,11 +31,12 @@ exports.XSS_VULNERABILITIES = {
|
|
|
30
31
|
remediation: 'HTML-encode all user input before rendering in HTML. Implement Content Security Policy (CSP). Use context-aware output encoding based on output location (HTML, JS, CSS, URL).',
|
|
31
32
|
},
|
|
32
33
|
[error_codes_js_1.VulnerabilityCode.XSS_STORED]: {
|
|
33
|
-
id:
|
|
34
|
+
id: 401,
|
|
34
35
|
code: error_codes_js_1.VulnerabilityCode.XSS_STORED,
|
|
35
36
|
title: 'Cross-Site Scripting - Stored',
|
|
36
37
|
description: 'Critical stored XSS vulnerability where malicious scripts are permanently saved in the application database and served to all users who view the affected content, enabling widespread session hijacking, credential theft, and malware distribution without requiring victim interaction beyond normal usage.',
|
|
37
38
|
severity: 'high',
|
|
39
|
+
levelId: 2,
|
|
38
40
|
category: 'xss',
|
|
39
41
|
scanner: 'xss',
|
|
40
42
|
cvss: {
|
|
@@ -51,11 +53,12 @@ exports.XSS_VULNERABILITIES = {
|
|
|
51
53
|
remediation: 'Sanitize all user input before storage. HTML-encode all dynamic content in responses. Implement strict Content Security Policy. Use HTTP-only and Secure flags for session cookies.',
|
|
52
54
|
},
|
|
53
55
|
[error_codes_js_1.VulnerabilityCode.XSS_DOM_BASED]: {
|
|
54
|
-
id:
|
|
56
|
+
id: 402,
|
|
55
57
|
code: error_codes_js_1.VulnerabilityCode.XSS_DOM_BASED,
|
|
56
58
|
title: 'Cross-Site Scripting - DOM Based',
|
|
57
59
|
description: 'DOM-based XSS vulnerability where the attack payload is processed entirely in the client-side JavaScript code without being sent to the server, typically through dangerous sinks like innerHTML, document.write(), or eval() that process URL fragments or user-controlled DOM elements.',
|
|
58
60
|
severity: 'medium',
|
|
61
|
+
levelId: 3,
|
|
59
62
|
category: 'xss',
|
|
60
63
|
scanner: 'xss',
|
|
61
64
|
cvss: {
|
|
@@ -72,11 +75,12 @@ exports.XSS_VULNERABILITIES = {
|
|
|
72
75
|
remediation: 'Avoid using dangerous DOM sinks like innerHTML and document.write(). Use textContent instead of innerHTML. Sanitize any DOM manipulation with user input. Implement Trusted Types if supported.',
|
|
73
76
|
},
|
|
74
77
|
[error_codes_js_1.VulnerabilityCode.XSS_SVG_INJECTION]: {
|
|
75
|
-
id:
|
|
78
|
+
id: 403,
|
|
76
79
|
code: error_codes_js_1.VulnerabilityCode.XSS_SVG_INJECTION,
|
|
77
80
|
title: 'Cross-Site Scripting - SVG Injection',
|
|
78
81
|
description: 'SVG-based XSS vulnerability where malicious JavaScript is embedded within SVG image files using script elements or event handlers like onload, which execute when the browser renders the SVG file as an image or inline element, bypassing image upload security controls.',
|
|
79
82
|
severity: 'high',
|
|
83
|
+
levelId: 2,
|
|
80
84
|
category: 'xss',
|
|
81
85
|
scanner: 'xss',
|
|
82
86
|
cvss: {
|
|
@@ -93,11 +97,12 @@ exports.XSS_VULNERABILITIES = {
|
|
|
93
97
|
remediation: 'Sanitize uploaded SVG files to remove script elements and event handlers. Serve user-uploaded SVGs from a separate domain. Set Content-Disposition: attachment for SVG downloads. Use Content-Security-Policy.',
|
|
94
98
|
},
|
|
95
99
|
[error_codes_js_1.VulnerabilityCode.XSS_CSTI_ANGULAR]: {
|
|
96
|
-
id:
|
|
100
|
+
id: 404,
|
|
97
101
|
code: error_codes_js_1.VulnerabilityCode.XSS_CSTI_ANGULAR,
|
|
98
102
|
title: 'Cross-Site Scripting - Angular Template Injection',
|
|
99
103
|
description: 'AngularJS client-side template injection vulnerability where user input containing Angular expressions like {{constructor.constructor("alert(1)")()}} is evaluated by the Angular template engine, leading to arbitrary JavaScript execution in the user browser context.',
|
|
100
104
|
severity: 'high',
|
|
105
|
+
levelId: 2,
|
|
101
106
|
category: 'xss',
|
|
102
107
|
scanner: 'xss',
|
|
103
108
|
cvss: {
|
|
@@ -115,11 +120,12 @@ exports.XSS_VULNERABILITIES = {
|
|
|
115
120
|
remediation: 'Upgrade from AngularJS to modern Angular which is not vulnerable to template injection. Use ng-non-bindable directive for user content. Encode special characters {{}} in user input. Apply strict CSP.',
|
|
116
121
|
},
|
|
117
122
|
[error_codes_js_1.VulnerabilityCode.XSS_CSP_BYPASS]: {
|
|
118
|
-
id:
|
|
123
|
+
id: 405,
|
|
119
124
|
code: error_codes_js_1.VulnerabilityCode.XSS_CSP_BYPASS,
|
|
120
125
|
title: 'Cross-Site Scripting - CSP Bypass',
|
|
121
126
|
description: 'XSS vulnerability that bypasses Content Security Policy protections through techniques like JSONP endpoints on whitelisted domains, base tag injection, Angular.js libraries on CDN, or other CSP bypass gadgets that allow script execution despite CSP controls being in place.',
|
|
122
127
|
severity: 'high',
|
|
128
|
+
levelId: 2,
|
|
123
129
|
category: 'xss',
|
|
124
130
|
scanner: 'xss',
|
|
125
131
|
cvss: {
|
|
@@ -136,11 +142,12 @@ exports.XSS_VULNERABILITIES = {
|
|
|
136
142
|
remediation: 'Review CSP for JSONP endpoints and Angular.js CDN inclusions. Use nonce-based CSP instead of allowlist domains. Add base-uri restriction. Fix the underlying XSS vulnerability.',
|
|
137
143
|
},
|
|
138
144
|
[error_codes_js_1.VulnerabilityCode.XSS_JS_CONTEXT]: {
|
|
139
|
-
id:
|
|
145
|
+
id: 406,
|
|
140
146
|
code: error_codes_js_1.VulnerabilityCode.XSS_JS_CONTEXT,
|
|
141
147
|
title: 'Cross-Site Scripting - JavaScript Context',
|
|
142
148
|
description: 'XSS vulnerability where user input is injected directly into JavaScript code blocks, allowing attackers to break out of string contexts and execute arbitrary JavaScript by injecting quote characters and script code, or modify application logic by injecting new statements.',
|
|
143
149
|
severity: 'high',
|
|
150
|
+
levelId: 2,
|
|
144
151
|
category: 'xss',
|
|
145
152
|
scanner: 'xss',
|
|
146
153
|
cvss: {
|
|
@@ -157,11 +164,12 @@ exports.XSS_VULNERABILITIES = {
|
|
|
157
164
|
remediation: 'Avoid inserting user data into JavaScript code. Use JSON.stringify() with proper encoding for data passed to JavaScript. Pass data through data attributes and access via DOM APIs instead.',
|
|
158
165
|
},
|
|
159
166
|
[error_codes_js_1.VulnerabilityCode.XSS_EVENT_HANDLER]: {
|
|
160
|
-
id:
|
|
167
|
+
id: 407,
|
|
161
168
|
code: error_codes_js_1.VulnerabilityCode.XSS_EVENT_HANDLER,
|
|
162
169
|
title: 'Cross-Site Scripting - Event Handler Injection',
|
|
163
170
|
description: 'XSS vulnerability through injection into HTML event handler attributes like onclick, onerror, onload, or onmouseover, allowing attackers to execute JavaScript when users interact with or simply view the affected page elements without requiring script tags.',
|
|
164
171
|
severity: 'high',
|
|
172
|
+
levelId: 2,
|
|
165
173
|
category: 'xss',
|
|
166
174
|
scanner: 'xss',
|
|
167
175
|
cvss: {
|
|
@@ -178,11 +186,12 @@ exports.XSS_VULNERABILITIES = {
|
|
|
178
186
|
remediation: 'Use proper HTML encoding for all user input in attributes. Avoid placing user input in event handler attributes. Use Content Security Policy with unsafe-inline disabled.',
|
|
179
187
|
},
|
|
180
188
|
[error_codes_js_1.VulnerabilityCode.XSS_SCRIPT_INJECTION]: {
|
|
181
|
-
id:
|
|
189
|
+
id: 408,
|
|
182
190
|
code: error_codes_js_1.VulnerabilityCode.XSS_SCRIPT_INJECTION,
|
|
183
191
|
title: 'Cross-Site Scripting - Script Tag Injection',
|
|
184
192
|
description: 'XSS vulnerability where attackers can inject complete script tags into the HTML response, enabling arbitrary JavaScript execution. This is often the most straightforward XSS exploitation when input is not properly sanitized before rendering.',
|
|
185
193
|
severity: 'high',
|
|
194
|
+
levelId: 2,
|
|
186
195
|
category: 'xss',
|
|
187
196
|
scanner: 'xss',
|
|
188
197
|
cvss: {
|
|
@@ -199,11 +208,12 @@ exports.XSS_VULNERABILITIES = {
|
|
|
199
208
|
remediation: 'Encode < and > characters in user input. Implement Content Security Policy. Use HTML sanitization libraries that remove script tags. Apply context-aware output encoding.',
|
|
200
209
|
},
|
|
201
210
|
[error_codes_js_1.VulnerabilityCode.XSS_HTML_INJECTION]: {
|
|
202
|
-
id:
|
|
211
|
+
id: 409,
|
|
203
212
|
code: error_codes_js_1.VulnerabilityCode.XSS_HTML_INJECTION,
|
|
204
213
|
title: 'Cross-Site Scripting - HTML Injection',
|
|
205
214
|
description: 'HTML injection vulnerability where attackers can inject arbitrary HTML elements that modify page structure, enabling phishing attacks through fake login forms, content spoofing, or combination with CSS to overlay malicious content over legitimate page elements.',
|
|
206
215
|
severity: 'medium',
|
|
216
|
+
levelId: 3,
|
|
207
217
|
category: 'xss',
|
|
208
218
|
scanner: 'xss',
|
|
209
219
|
cvss: {
|
|
@@ -220,11 +230,12 @@ exports.XSS_VULNERABILITIES = {
|
|
|
220
230
|
remediation: 'HTML-encode all user input. Use allowlist-based HTML sanitization if rich text is required. Implement Content Security Policy to restrict form actions and frame sources.',
|
|
221
231
|
},
|
|
222
232
|
[error_codes_js_1.VulnerabilityCode.XSS_ATTRIBUTE_INJECTION]: {
|
|
223
|
-
id:
|
|
233
|
+
id: 410,
|
|
224
234
|
code: error_codes_js_1.VulnerabilityCode.XSS_ATTRIBUTE_INJECTION,
|
|
225
235
|
title: 'Cross-Site Scripting - Attribute Injection',
|
|
226
236
|
description: 'XSS vulnerability where user input is placed in HTML attributes without proper encoding, allowing attackers to break out of the attribute context and inject new attributes or event handlers by using quote characters and spaces.',
|
|
227
237
|
severity: 'medium',
|
|
238
|
+
levelId: 3,
|
|
228
239
|
category: 'xss',
|
|
229
240
|
scanner: 'xss',
|
|
230
241
|
cvss: {
|
|
@@ -241,11 +252,12 @@ exports.XSS_VULNERABILITIES = {
|
|
|
241
252
|
remediation: 'HTML-encode quotes (single and double) when placing user input in attributes. Always use quoted attributes. Avoid placing user input in dangerous attributes like href, src, or event handlers.',
|
|
242
253
|
},
|
|
243
254
|
[error_codes_js_1.VulnerabilityCode.XSS_CSS_INJECTION]: {
|
|
244
|
-
id:
|
|
255
|
+
id: 411,
|
|
245
256
|
code: error_codes_js_1.VulnerabilityCode.XSS_CSS_INJECTION,
|
|
246
257
|
title: 'Cross-Site Scripting - CSS Injection',
|
|
247
258
|
description: 'CSS injection vulnerability where attackers can inject malicious CSS rules to exfiltrate data through CSS selectors and background URLs, modify page appearance for phishing, or in older browsers achieve JavaScript execution through CSS expressions.',
|
|
248
259
|
severity: 'medium',
|
|
260
|
+
levelId: 3,
|
|
249
261
|
category: 'xss',
|
|
250
262
|
scanner: 'xss',
|
|
251
263
|
cvss: {
|
|
@@ -262,11 +274,12 @@ exports.XSS_VULNERABILITIES = {
|
|
|
262
274
|
remediation: 'Sanitize CSS input to remove url() functions and expression() directives. Use CSS-specific encoding. Implement Content Security Policy with style-src restrictions.',
|
|
263
275
|
},
|
|
264
276
|
[error_codes_js_1.VulnerabilityCode.XSS_TEMPLATE_LITERAL]: {
|
|
265
|
-
id:
|
|
277
|
+
id: 412,
|
|
266
278
|
code: error_codes_js_1.VulnerabilityCode.XSS_TEMPLATE_LITERAL,
|
|
267
279
|
title: 'Cross-Site Scripting - Template Literal Injection',
|
|
268
280
|
description: 'XSS vulnerability through JavaScript template literals (backtick strings) where user input can break out of the template context or inject expressions using ${} syntax, executing arbitrary JavaScript in the client browser context.',
|
|
269
281
|
severity: 'high',
|
|
282
|
+
levelId: 2,
|
|
270
283
|
category: 'xss',
|
|
271
284
|
scanner: 'xss',
|
|
272
285
|
cvss: {
|
|
@@ -283,11 +296,12 @@ exports.XSS_VULNERABILITIES = {
|
|
|
283
296
|
remediation: 'Avoid placing user input inside template literals. Escape backticks, dollar signs, and braces. Use tagged template functions with proper escaping for user data.',
|
|
284
297
|
},
|
|
285
298
|
[error_codes_js_1.VulnerabilityCode.XSS_MUTATION_BASED]: {
|
|
286
|
-
id:
|
|
299
|
+
id: 413,
|
|
287
300
|
code: error_codes_js_1.VulnerabilityCode.XSS_MUTATION_BASED,
|
|
288
301
|
title: 'Cross-Site Scripting - Mutation XSS',
|
|
289
302
|
description: 'Mutation-based XSS (mXSS) vulnerability exploiting browser HTML parser quirks and DOM mutations where seemingly safe HTML is transformed into executable script through browser parsing behaviors, bypassing traditional sanitization.',
|
|
290
303
|
severity: 'high',
|
|
304
|
+
levelId: 2,
|
|
291
305
|
category: 'xss',
|
|
292
306
|
scanner: 'xss',
|
|
293
307
|
cvss: {
|
|
@@ -304,11 +318,12 @@ exports.XSS_VULNERABILITIES = {
|
|
|
304
318
|
remediation: 'Use DOMPurify or similar mXSS-aware sanitizers. Avoid innerHTML with user content. Implement Trusted Types. Stay updated on browser parsing behavior changes.',
|
|
305
319
|
},
|
|
306
320
|
[error_codes_js_1.VulnerabilityCode.XSS_CSTI_VUE]: {
|
|
307
|
-
id:
|
|
321
|
+
id: 414,
|
|
308
322
|
code: error_codes_js_1.VulnerabilityCode.XSS_CSTI_VUE,
|
|
309
323
|
title: 'Cross-Site Scripting - Vue.js Template Injection',
|
|
310
324
|
description: 'Vue.js client-side template injection vulnerability where user input containing Vue expression syntax like {{}} or v-bind directives is evaluated by the Vue template compiler, leading to arbitrary JavaScript execution in the browser context.',
|
|
311
325
|
severity: 'high',
|
|
326
|
+
levelId: 2,
|
|
312
327
|
category: 'xss',
|
|
313
328
|
scanner: 'xss',
|
|
314
329
|
cvss: {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Category registry - human-friendly titles for categories.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.CATEGORY_REGISTRY = void 0;
|
|
7
|
+
exports.CATEGORY_REGISTRY = {
|
|
8
|
+
"injection": { title: "Injection" },
|
|
9
|
+
"xss": { title: "Cross-Site Scripting" },
|
|
10
|
+
"authentication": { title: "Authentication" },
|
|
11
|
+
"access_control": { title: "Access Control" },
|
|
12
|
+
"configuration": { title: "Configuration" },
|
|
13
|
+
"information_disclosure": { title: "Information Disclosure" },
|
|
14
|
+
"cryptographic": { title: "Cryptographic" },
|
|
15
|
+
"business_logic": { title: "Business Logic" },
|
|
16
|
+
"ssrf": { title: "Server-Side Request Forgery" },
|
|
17
|
+
"file_inclusion": { title: "File Inclusion" },
|
|
18
|
+
};
|
package/dist-cjs/error-codes.js
CHANGED
|
@@ -175,6 +175,26 @@ var VulnerabilityCode;
|
|
|
175
175
|
// ========================================
|
|
176
176
|
// DIRECTORY BROWSING (DIRBROWSE_*)
|
|
177
177
|
// ========================================
|
|
178
|
+
VulnerabilityCode["DIRBROWSE_GENERIC"] = "DIRBROWSE_GENERIC";
|
|
179
|
+
VulnerabilityCode["DIRBROWSE_GENERIC_SENSITIVE"] = "DIRBROWSE_GENERIC_SENSITIVE";
|
|
180
|
+
VulnerabilityCode["DIRBROWSE_APACHE"] = "DIRBROWSE_APACHE";
|
|
181
|
+
VulnerabilityCode["DIRBROWSE_APACHE_SENSITIVE"] = "DIRBROWSE_APACHE_SENSITIVE";
|
|
182
|
+
VulnerabilityCode["DIRBROWSE_NGINX"] = "DIRBROWSE_NGINX";
|
|
183
|
+
VulnerabilityCode["DIRBROWSE_NGINX_SENSITIVE"] = "DIRBROWSE_NGINX_SENSITIVE";
|
|
184
|
+
VulnerabilityCode["DIRBROWSE_IIS"] = "DIRBROWSE_IIS";
|
|
185
|
+
VulnerabilityCode["DIRBROWSE_IIS_SENSITIVE"] = "DIRBROWSE_IIS_SENSITIVE";
|
|
186
|
+
VulnerabilityCode["DIRBROWSE_TOMCAT"] = "DIRBROWSE_TOMCAT";
|
|
187
|
+
VulnerabilityCode["DIRBROWSE_TOMCAT_SENSITIVE"] = "DIRBROWSE_TOMCAT_SENSITIVE";
|
|
188
|
+
VulnerabilityCode["DIRBROWSE_CADDY"] = "DIRBROWSE_CADDY";
|
|
189
|
+
VulnerabilityCode["DIRBROWSE_CADDY_SENSITIVE"] = "DIRBROWSE_CADDY_SENSITIVE";
|
|
190
|
+
VulnerabilityCode["DIRBROWSE_WEBDAV"] = "DIRBROWSE_WEBDAV";
|
|
191
|
+
VulnerabilityCode["DIRBROWSE_WEBDAV_SENSITIVE"] = "DIRBROWSE_WEBDAV_SENSITIVE";
|
|
192
|
+
VulnerabilityCode["DIRBROWSE_S3"] = "DIRBROWSE_S3";
|
|
193
|
+
VulnerabilityCode["DIRBROWSE_S3_SENSITIVE"] = "DIRBROWSE_S3_SENSITIVE";
|
|
194
|
+
VulnerabilityCode["DIRBROWSE_GCS"] = "DIRBROWSE_GCS";
|
|
195
|
+
VulnerabilityCode["DIRBROWSE_GCS_SENSITIVE"] = "DIRBROWSE_GCS_SENSITIVE";
|
|
196
|
+
VulnerabilityCode["DIRBROWSE_AZURE_BLOB"] = "DIRBROWSE_AZURE_BLOB";
|
|
197
|
+
VulnerabilityCode["DIRBROWSE_AZURE_BLOB_SENSITIVE"] = "DIRBROWSE_AZURE_BLOB_SENSITIVE";
|
|
178
198
|
VulnerabilityCode["DIRBROWSE_ENABLED"] = "DIRBROWSE_ENABLED";
|
|
179
199
|
VulnerabilityCode["DIRBROWSE_SENSITIVE"] = "DIRBROWSE_SENSITIVE";
|
|
180
200
|
// ========================================
|
package/dist-cjs/index.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Exports all vulnerability codes, definitions, and lookup utilities
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.SENSITIVE_PATH_VULNERABILITIES = exports.CONFIG_VULNERABILITIES = exports.AUTH_VULNERABILITIES = exports.SSRF_VULNERABILITIES = exports.XSS_VULNERABILITIES = exports.INJECTION_VULNERABILITIES = exports.VulnerabilityCode = exports.VULNERABILITY_REGISTRY = void 0;
|
|
8
|
+
exports.SCANNER_REGISTRY = exports.CATEGORY_REGISTRY = exports.SENSITIVE_PATH_VULNERABILITIES = exports.CONFIG_VULNERABILITIES = exports.AUTH_VULNERABILITIES = exports.SSRF_VULNERABILITIES = exports.XSS_VULNERABILITIES = exports.INJECTION_VULNERABILITIES = exports.VulnerabilityCode = exports.VULNERABILITY_REGISTRY = void 0;
|
|
9
9
|
exports.getVulnerabilityDefinition = getVulnerabilityDefinition;
|
|
10
10
|
exports.getVulnerabilitiesByScanner = getVulnerabilitiesByScanner;
|
|
11
11
|
exports.getVulnerabilitiesByCategory = getVulnerabilitiesByCategory;
|
|
@@ -27,6 +27,10 @@ const configuration_js_1 = require("./categories/configuration.js");
|
|
|
27
27
|
Object.defineProperty(exports, "CONFIG_VULNERABILITIES", { enumerable: true, get: function () { return configuration_js_1.CONFIG_VULNERABILITIES; } });
|
|
28
28
|
const sensitive_paths_js_1 = require("./categories/sensitive-paths.js");
|
|
29
29
|
Object.defineProperty(exports, "SENSITIVE_PATH_VULNERABILITIES", { enumerable: true, get: function () { return sensitive_paths_js_1.SENSITIVE_PATH_VULNERABILITIES; } });
|
|
30
|
+
const category_js_1 = require("./category.js");
|
|
31
|
+
Object.defineProperty(exports, "CATEGORY_REGISTRY", { enumerable: true, get: function () { return category_js_1.CATEGORY_REGISTRY; } });
|
|
32
|
+
const scanner_js_1 = require("./scanner.js");
|
|
33
|
+
Object.defineProperty(exports, "SCANNER_REGISTRY", { enumerable: true, get: function () { return scanner_js_1.SCANNER_REGISTRY; } });
|
|
30
34
|
/**
|
|
31
35
|
* Complete vulnerability registry combining all categories
|
|
32
36
|
*/
|
|
@@ -104,4 +108,6 @@ exports.default = {
|
|
|
104
108
|
getAllVulnerabilityCodes,
|
|
105
109
|
getVulnerabilityCount,
|
|
106
110
|
createFinding,
|
|
111
|
+
CATEGORY_REGISTRY: category_js_1.CATEGORY_REGISTRY,
|
|
112
|
+
SCANNER_REGISTRY: scanner_js_1.SCANNER_REGISTRY,
|
|
107
113
|
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Scanner registry - human-friendly titles for scanners.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.SCANNER_REGISTRY = void 0;
|
|
7
|
+
exports.SCANNER_REGISTRY = {
|
|
8
|
+
"broken-access": { title: "Broken Access" },
|
|
9
|
+
"command-injection": { title: "Command Injection" },
|
|
10
|
+
"deserialization": { title: "Deserialization" },
|
|
11
|
+
"directory-browsing": { title: "Directory Browsing" },
|
|
12
|
+
"host-header": { title: "Host Header" },
|
|
13
|
+
"jwt": { title: "JSON WEB TOKEN" },
|
|
14
|
+
"local-file-inclusion": { title: "Local File Inclusion" },
|
|
15
|
+
"model-state": { title: "Model State" },
|
|
16
|
+
"redirect-route": { title: "Redirect Route" },
|
|
17
|
+
"security-headers": { title: "Security Headers" },
|
|
18
|
+
"sensitive-path-scout": { title: "Sensitive Path Scout" },
|
|
19
|
+
"sql-injection": { title: "SQL Injection" },
|
|
20
|
+
"ssrf": { title: "SSRF" },
|
|
21
|
+
"ssti": { title: "SSTI" },
|
|
22
|
+
"xpath-injection": { title: "XPath Injection" },
|
|
23
|
+
"xss": { title: "XSS" },
|
|
24
|
+
"xxe": { title: "XXE" },
|
|
25
|
+
};
|
package/package.json
CHANGED
|
@@ -1,37 +1,40 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
2
|
+
"name": "@zerothreatai/vulnerability-registry",
|
|
3
|
+
"version": "5.0.0",
|
|
4
|
+
"description": "Centralized vulnerability definitions, CVSS scores, and references for ZeroThreat scanners",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"ids:assign": "tsx scripts/assign-ids.ts",
|
|
10
|
+
"ids:check": "tsx scripts/check-duplicate-ids.ts",
|
|
11
|
+
"build:esm": "tsc -p tsconfig.json",
|
|
12
|
+
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
13
|
+
"build": "npm run build:esm && npm run build:cjs",
|
|
14
|
+
"postbuild": "node scripts/write-cjs-package.cjs",
|
|
15
|
+
"prepack": "npm run build",
|
|
16
|
+
"test": "vitest run"
|
|
17
|
+
},
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
21
|
+
"import": "./dist/index.js",
|
|
22
|
+
"require": "./dist-cjs/index.js"
|
|
15
23
|
},
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"require": "./dist-cjs/index.js"
|
|
21
|
-
},
|
|
22
|
-
"./types": {
|
|
23
|
-
"types": "./dist/types.d.ts",
|
|
24
|
-
"import": "./dist/types.js",
|
|
25
|
-
"require": "./dist-cjs/types.js"
|
|
26
|
-
},
|
|
27
|
-
"./error-codes": {
|
|
28
|
-
"types": "./dist/error-codes.d.ts",
|
|
29
|
-
"import": "./dist/error-codes.js",
|
|
30
|
-
"require": "./dist-cjs/error-codes.js"
|
|
31
|
-
}
|
|
24
|
+
"./types": {
|
|
25
|
+
"types": "./dist/types.d.ts",
|
|
26
|
+
"import": "./dist/types.js",
|
|
27
|
+
"require": "./dist-cjs/types.js"
|
|
32
28
|
},
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
|
|
29
|
+
"./error-codes": {
|
|
30
|
+
"types": "./dist/error-codes.d.ts",
|
|
31
|
+
"import": "./dist/error-codes.js",
|
|
32
|
+
"require": "./dist-cjs/error-codes.js"
|
|
36
33
|
}
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"tsx": "^4.19.2",
|
|
37
|
+
"typescript": "^5.0.0",
|
|
38
|
+
"vitest": "^1.0.0"
|
|
39
|
+
}
|
|
37
40
|
}
|
|
@@ -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();
|