@interlace/eslint-devkit 1.5.0 â 1.6.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/package.json +21 -11
- package/src/aria-definitions.js +0 -14
- package/src/ast/ast-utils.js +0 -72
- package/src/ast/index.js +0 -6
- package/src/ast-node-types.d.ts +29 -0
- package/src/ast-node-types.js +174 -0
- package/src/index.d.ts +11 -2
- package/src/index.js +5 -38
- package/src/messaging/config.js +0 -88
- package/src/messaging/constants.js +20 -142
- package/src/messaging/formatters-ai.js +0 -89
- package/src/messaging/formatters-v2.js +0 -151
- package/src/messaging/formatters.js +2 -145
- package/src/messaging/index.js +0 -6
- package/src/messaging/types-v2.js +0 -5
- package/src/messaging/types.js +0 -5
- package/src/node/fs.js +0 -61
- package/src/node/index.js +0 -6
- package/src/node/os.js +0 -33
- package/src/node/path.js +0 -126
- package/src/resolver/dependency-analysis.js +64 -562
- package/src/resolver/index.js +0 -6
- package/src/resolver/resolver-adapter.js +0 -39
- package/src/resolver/resolver-detection.js +0 -48
- package/src/resolver/resolver.d.ts +11 -0
- package/src/resolver/resolver.js +49 -112
- package/src/resolver.js +0 -5
- package/src/rule-creation/index.js +0 -8
- package/src/rule-creation/mock-context.js +0 -9
- package/src/rule-creation/rule-creator.d.ts +59 -10
- package/src/rule-creation/rule-creator.js +64 -40
- package/src/rule-creation/sql-injection-rule.js +0 -52
- package/src/security/index.js +0 -6
- package/src/security/security-utils.js +9 -287
- package/src/types/index.js +0 -9
- package/src/types/meta-augmentation.js +0 -5
- package/src/types/type-utils.d.ts +1 -1
- package/src/types/type-utils.js +34 -145
- package/AGENTS.md +0 -151
- package/CHANGELOG.md +0 -181
package/src/messaging/config.js
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2025 Ofri Peretz
|
|
4
|
-
* Licensed under the MIT License. Use of this source code is governed by the
|
|
5
|
-
* MIT license that can be found in the LICENSE file.
|
|
6
|
-
*/
|
|
7
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
3
|
exports.KNOWN_AGENT_ENVIRONMENTS = void 0;
|
|
9
4
|
exports.detectKnownAgentEnvironment = detectKnownAgentEnvironment;
|
|
@@ -14,56 +9,27 @@ exports.getAIMessagingMode = getAIMessagingMode;
|
|
|
14
9
|
exports.setTokenCompression = setTokenCompression;
|
|
15
10
|
exports.isTokenCompressionEnabled = isTokenCompressionEnabled;
|
|
16
11
|
exports.resetGlobalAIConfig = resetGlobalAIConfig;
|
|
17
|
-
/**
|
|
18
|
-
* Known AI Agent environments and their detection indicators
|
|
19
|
-
* Each entry includes a link to documentation confirming the env var
|
|
20
|
-
*/
|
|
21
12
|
exports.KNOWN_AGENT_ENVIRONMENTS = {
|
|
22
|
-
/**
|
|
23
|
-
* Cursor IDE AI Agent
|
|
24
|
-
* @see https://docs.cursor.com/context/rules-for-ai#agent-specific-rules
|
|
25
|
-
* @see https://forum.cursor.com/t/feature-request-env-variable-for-composer-agent-runs/49449
|
|
26
|
-
*/
|
|
27
13
|
CURSOR: {
|
|
28
14
|
envVar: 'CURSOR_AGENT',
|
|
29
15
|
mode: 'IDE_CURSOR',
|
|
30
16
|
description: 'Cursor IDE AI Agent',
|
|
31
17
|
},
|
|
32
|
-
/**
|
|
33
|
-
* GitHub Copilot Workspace
|
|
34
|
-
* @see https://docs.github.com/en/copilot/using-github-copilot/using-github-copilot-for-pull-requests
|
|
35
|
-
* Note: Env var is convention-based, verify in your Copilot Workspace runtime
|
|
36
|
-
*/
|
|
37
18
|
GITHUB_COPILOT: {
|
|
38
19
|
envVar: 'GITHUB_COPILOT_WORKSPACE',
|
|
39
20
|
mode: 'AGENT_JSON',
|
|
40
21
|
description: 'GitHub Copilot Workspace',
|
|
41
22
|
},
|
|
42
|
-
/**
|
|
43
|
-
* Anthropic Model Context Protocol (Claude Code, etc.)
|
|
44
|
-
* @see https://modelcontextprotocol.io/introduction
|
|
45
|
-
* Note: Proposed convention for MCP-based agents
|
|
46
|
-
*/
|
|
47
23
|
ANTHROPIC_MCP: {
|
|
48
24
|
envVar: 'ANTHROPIC_MCP',
|
|
49
25
|
mode: 'AGENT_JSON',
|
|
50
26
|
description: 'Anthropic Model Context Protocol',
|
|
51
27
|
},
|
|
52
|
-
/**
|
|
53
|
-
* OpenAI Agent / Code Interpreter
|
|
54
|
-
* @see https://platform.openai.com/docs/assistants/tools/code-interpreter
|
|
55
|
-
* Note: Proposed convention for OpenAI-based agents
|
|
56
|
-
*/
|
|
57
28
|
OPENAI_AGENT: {
|
|
58
29
|
envVar: 'OPENAI_AGENT',
|
|
59
30
|
mode: 'AGENT_JSON',
|
|
60
31
|
description: 'OpenAI Agent / Code Interpreter',
|
|
61
32
|
},
|
|
62
|
-
/**
|
|
63
|
-
* Generic AI Agent flag
|
|
64
|
-
* Use this when your agent framework doesn't have a specific env var
|
|
65
|
-
* Set AI_AGENT=true in your agent's environment
|
|
66
|
-
*/
|
|
67
33
|
GENERIC_AI: {
|
|
68
34
|
envVar: 'AI_AGENT',
|
|
69
35
|
mode: 'AGENT_JSON',
|
|
@@ -74,13 +40,6 @@ const GLOBAL_AI_CONFIG = {
|
|
|
74
40
|
mode: 'CLI',
|
|
75
41
|
compression: false,
|
|
76
42
|
};
|
|
77
|
-
// ============================================================================
|
|
78
|
-
// DETECTION FUNCTIONS
|
|
79
|
-
// ============================================================================
|
|
80
|
-
/**
|
|
81
|
-
* Detects known AI agent environments from environment variables
|
|
82
|
-
* Returns the appropriate mode if a known environment is detected
|
|
83
|
-
*/
|
|
84
43
|
function detectKnownAgentEnvironment() {
|
|
85
44
|
for (const env of Object.values(exports.KNOWN_AGENT_ENVIRONMENTS)) {
|
|
86
45
|
if (process.env[env.envVar]) {
|
|
@@ -89,97 +48,50 @@ function detectKnownAgentEnvironment() {
|
|
|
89
48
|
}
|
|
90
49
|
return null;
|
|
91
50
|
}
|
|
92
|
-
/**
|
|
93
|
-
* Detects environment from env vars (simple detection)
|
|
94
|
-
*/
|
|
95
51
|
function detectEnvironmentFromEnv() {
|
|
96
|
-
// Explicit override via env var
|
|
97
52
|
if (process.env['ESLINT_AI_MODE']) {
|
|
98
53
|
return process.env['ESLINT_AI_MODE'];
|
|
99
54
|
}
|
|
100
|
-
// Known agent detection
|
|
101
55
|
const detected = detectKnownAgentEnvironment();
|
|
102
56
|
if (detected)
|
|
103
57
|
return detected;
|
|
104
|
-
// CI detection
|
|
105
58
|
if (process.env['CI'])
|
|
106
59
|
return 'CI';
|
|
107
|
-
// Default
|
|
108
60
|
return 'CLI';
|
|
109
61
|
}
|
|
110
|
-
// Auto-initialize on import
|
|
111
62
|
GLOBAL_AI_CONFIG.mode = detectEnvironmentFromEnv();
|
|
112
|
-
// ============================================================================
|
|
113
|
-
// CONTEXT-AWARE RESOLUTION (Next-Gen)
|
|
114
|
-
// ============================================================================
|
|
115
|
-
/**
|
|
116
|
-
* Resolves the AI messaging mode based on the priority chain:
|
|
117
|
-
* 1. ENV VAR (ESLINT_AI_MODE) - Highest priority
|
|
118
|
-
* 2. Explicit setting (interlace/ai-mode)
|
|
119
|
-
* 3. Auto-detection (if enableAutoAgentDetection: true)
|
|
120
|
-
* 4. Default: CLI
|
|
121
|
-
*
|
|
122
|
-
* @param context - ESLint rule context (or context-like object with settings)
|
|
123
|
-
* @returns The resolved messaging environment
|
|
124
|
-
*
|
|
125
|
-
* @example
|
|
126
|
-
* ```typescript
|
|
127
|
-
* // In an ESLint rule
|
|
128
|
-
* create(context) {
|
|
129
|
-
* const mode = resolveAIMode(context);
|
|
130
|
-
* // mode is 'CLI' | 'CI' | 'IDE_CURSOR' | 'AGENT_JSON'
|
|
131
|
-
* }
|
|
132
|
-
* ```
|
|
133
|
-
*/
|
|
134
63
|
function resolveAIMode(context) {
|
|
135
|
-
// 1. ENV VAR (Highest priority - agent escape hatch)
|
|
136
64
|
if (process.env['ESLINT_AI_MODE']) {
|
|
137
65
|
return process.env['ESLINT_AI_MODE'];
|
|
138
66
|
}
|
|
139
|
-
// 2. EXPLICIT CONFIG (Developer override via settings)
|
|
140
67
|
if (context?.settings?.['interlace/ai-mode']) {
|
|
141
68
|
return context.settings['interlace/ai-mode'];
|
|
142
69
|
}
|
|
143
|
-
// 3. AUTO-DETECTION (Only if opted-in)
|
|
144
70
|
if (context?.settings?.['interlace/enableAutoAgentDetection'] === true) {
|
|
145
71
|
const detected = detectKnownAgentEnvironment();
|
|
146
72
|
if (detected)
|
|
147
73
|
return detected;
|
|
148
74
|
}
|
|
149
|
-
// 4. DEFAULT: Human CLI
|
|
150
75
|
return 'CLI';
|
|
151
76
|
}
|
|
152
|
-
/**
|
|
153
|
-
* Resolves whether compression is enabled
|
|
154
|
-
*/
|
|
155
77
|
function resolveCompression(context) {
|
|
156
|
-
// Explicit setting takes priority
|
|
157
78
|
if (context?.settings?.['interlace/compression'] !== undefined) {
|
|
158
79
|
return context.settings['interlace/compression'];
|
|
159
80
|
}
|
|
160
|
-
// Fall back to global config
|
|
161
81
|
return GLOBAL_AI_CONFIG.compression;
|
|
162
82
|
}
|
|
163
|
-
// ============================================================================
|
|
164
|
-
// LEGACY API (Backward compatibility)
|
|
165
|
-
// ============================================================================
|
|
166
|
-
/** @deprecated Use resolveAIMode(context) instead */
|
|
167
83
|
function setAIMessagingMode(mode) {
|
|
168
84
|
GLOBAL_AI_CONFIG.mode = mode;
|
|
169
85
|
}
|
|
170
|
-
/** @deprecated Use resolveAIMode(context) instead */
|
|
171
86
|
function getAIMessagingMode() {
|
|
172
87
|
return GLOBAL_AI_CONFIG.mode;
|
|
173
88
|
}
|
|
174
|
-
/** @deprecated Use resolveCompression(context) instead */
|
|
175
89
|
function setTokenCompression(enabled) {
|
|
176
90
|
GLOBAL_AI_CONFIG.compression = enabled;
|
|
177
91
|
}
|
|
178
|
-
/** @deprecated Use resolveCompression(context) instead */
|
|
179
92
|
function isTokenCompressionEnabled() {
|
|
180
93
|
return GLOBAL_AI_CONFIG.compression;
|
|
181
94
|
}
|
|
182
|
-
/** Reset config to defaults (for testing) */
|
|
183
95
|
function resetGlobalAIConfig() {
|
|
184
96
|
GLOBAL_AI_CONFIG.mode = 'CLI';
|
|
185
97
|
GLOBAL_AI_CONFIG.compression = false;
|
|
@@ -1,19 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2025 Ofri Peretz
|
|
4
|
-
* Licensed under the MIT License. Use of this source code is governed by the
|
|
5
|
-
* MIT license that can be found in the LICENSE file.
|
|
6
|
-
*/
|
|
7
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
3
|
exports.MessageIcons = exports.CWE_COMPLIANCE_MAPPING = exports.CWE_MAPPING = exports.OWASP_2021_TO_2025 = exports.OWASP_DETAILS = exports.OWASP_SERVERLESS_DETAILS = exports.OWASP_2021_DETAILS = exports.OWASP_2025_DETAILS = exports.CVSS_RANGES = void 0;
|
|
9
4
|
exports.severityToCVSS = severityToCVSS;
|
|
10
|
-
// ============================================================================
|
|
11
|
-
// SEVERITY TYPES & CVSS MAPPING (NIST Standard)
|
|
12
|
-
// ============================================================================
|
|
13
|
-
/**
|
|
14
|
-
* CVSS 3.1 Score mapping per NIST guidelines
|
|
15
|
-
* @see https://nvd.nist.gov/vuln-metrics/cvss
|
|
16
|
-
*/
|
|
17
5
|
exports.CVSS_RANGES = {
|
|
18
6
|
CRITICAL: { min: 9.0, max: 10.0, label: '9.0-10.0' },
|
|
19
7
|
HIGH: { min: 7.0, max: 8.9, label: '7.0-8.9' },
|
|
@@ -21,97 +9,72 @@ exports.CVSS_RANGES = {
|
|
|
21
9
|
LOW: { min: 0.1, max: 3.9, label: '0.1-3.9' },
|
|
22
10
|
INFO: { min: 0.0, max: 0.0, label: '0.0' },
|
|
23
11
|
};
|
|
24
|
-
/**
|
|
25
|
-
* Convert severity to representative CVSS score
|
|
26
|
-
*/
|
|
27
12
|
function severityToCVSS(severity) {
|
|
28
13
|
const range = exports.CVSS_RANGES[severity];
|
|
29
14
|
return Number(((range.min + range.max) / 2).toFixed(1));
|
|
30
15
|
}
|
|
31
|
-
// ============================================================================
|
|
32
|
-
// OWASP TOP 10 2025 CATEGORIES (NEW - Released November 2025)
|
|
33
|
-
// ============================================================================
|
|
34
|
-
/**
|
|
35
|
-
* OWASP Top 10 2025 Categories (Latest)
|
|
36
|
-
* @see https://owasp.org/Top10/2025/
|
|
37
|
-
*
|
|
38
|
-
* Key changes from 2021:
|
|
39
|
-
* - A03: NEW "Software Supply Chain Failures" (consolidates A06:2021 + A08:2021)
|
|
40
|
-
* - A10: NEW "Mishandling of Exceptional Conditions" (replaces SSRF)
|
|
41
|
-
* - Categories reordered based on 2025 threat landscape
|
|
42
|
-
*/
|
|
43
|
-
/**
|
|
44
|
-
* OWASP 2025 category details (PRIMARY)
|
|
45
|
-
*
|
|
46
|
-
* NOTE: OWASP Top 10 2025 URLs use a projected format. If links are broken,
|
|
47
|
-
* the system falls back to equivalent 2021 categories via OWASP_2021_TO_2025 mapping.
|
|
48
|
-
* Monitor https://owasp.org/Top10/ for official 2025 release URLs.
|
|
49
|
-
*/
|
|
50
16
|
exports.OWASP_2025_DETAILS = {
|
|
51
17
|
'A01:2025': {
|
|
52
18
|
name: 'Broken Access Control',
|
|
53
19
|
description: 'Access control enforces policy such that users cannot act outside their intended permissions',
|
|
54
|
-
link: 'https://owasp.org/Top10/A01_2021-Broken_Access_Control/',
|
|
20
|
+
link: 'https://owasp.org/Top10/A01_2021-Broken_Access_Control/',
|
|
55
21
|
fallbackLink: 'https://owasp.org/Top10/A01_2021-Broken_Access_Control/',
|
|
56
22
|
},
|
|
57
23
|
'A02:2025': {
|
|
58
24
|
name: 'Security Misconfiguration',
|
|
59
25
|
description: 'Missing security hardening, improperly configured permissions, default credentials',
|
|
60
|
-
link: 'https://owasp.org/Top10/A05_2021-Security_Misconfiguration/',
|
|
26
|
+
link: 'https://owasp.org/Top10/A05_2021-Security_Misconfiguration/',
|
|
61
27
|
fallbackLink: 'https://owasp.org/Top10/A05_2021-Security_Misconfiguration/',
|
|
62
28
|
},
|
|
63
29
|
'A03:2025': {
|
|
64
30
|
name: 'Software Supply Chain Failures',
|
|
65
31
|
description: 'Vulnerabilities in dependencies, malicious packages, compromised CI/CD pipelines',
|
|
66
|
-
link: 'https://owasp.org/Top10/A06_2021-Vulnerable_and_Outdated_Components/',
|
|
32
|
+
link: 'https://owasp.org/Top10/A06_2021-Vulnerable_and_Outdated_Components/',
|
|
67
33
|
fallbackLink: 'https://owasp.org/Top10/A06_2021-Vulnerable_and_Outdated_Components/',
|
|
68
34
|
},
|
|
69
35
|
'A04:2025': {
|
|
70
36
|
name: 'Cryptographic Failures',
|
|
71
37
|
description: 'Failures related to cryptography leading to sensitive data exposure',
|
|
72
|
-
link: 'https://owasp.org/Top10/A02_2021-Cryptographic_Failures/',
|
|
38
|
+
link: 'https://owasp.org/Top10/A02_2021-Cryptographic_Failures/',
|
|
73
39
|
fallbackLink: 'https://owasp.org/Top10/A02_2021-Cryptographic_Failures/',
|
|
74
40
|
},
|
|
75
41
|
'A05:2025': {
|
|
76
42
|
name: 'Injection',
|
|
77
43
|
description: 'User-supplied data not validated, filtered, or sanitized by the application',
|
|
78
|
-
link: 'https://owasp.org/Top10/A03_2021-Injection/',
|
|
44
|
+
link: 'https://owasp.org/Top10/A03_2021-Injection/',
|
|
79
45
|
fallbackLink: 'https://owasp.org/Top10/A03_2021-Injection/',
|
|
80
46
|
},
|
|
81
47
|
'A06:2025': {
|
|
82
48
|
name: 'Insecure Design',
|
|
83
49
|
description: 'Missing or ineffective control design, distinct from implementation flaws',
|
|
84
|
-
link: 'https://owasp.org/Top10/A04_2021-Insecure_Design/',
|
|
50
|
+
link: 'https://owasp.org/Top10/A04_2021-Insecure_Design/',
|
|
85
51
|
fallbackLink: 'https://owasp.org/Top10/A04_2021-Insecure_Design/',
|
|
86
52
|
},
|
|
87
53
|
'A07:2025': {
|
|
88
54
|
name: 'Authentication Failures',
|
|
89
55
|
description: 'User identity, authentication, and session management weaknesses',
|
|
90
|
-
link: 'https://owasp.org/Top10/A07_2021-Identification_and_Authentication_Failures/',
|
|
56
|
+
link: 'https://owasp.org/Top10/A07_2021-Identification_and_Authentication_Failures/',
|
|
91
57
|
fallbackLink: 'https://owasp.org/Top10/A07_2021-Identification_and_Authentication_Failures/',
|
|
92
58
|
},
|
|
93
59
|
'A08:2025': {
|
|
94
60
|
name: 'Software or Data Integrity Failures',
|
|
95
61
|
description: 'Code and infrastructure that does not protect against integrity violations',
|
|
96
|
-
link: 'https://owasp.org/Top10/A08_2021-Software_and_Data_Integrity_Failures/',
|
|
62
|
+
link: 'https://owasp.org/Top10/A08_2021-Software_and_Data_Integrity_Failures/',
|
|
97
63
|
fallbackLink: 'https://owasp.org/Top10/A08_2021-Software_and_Data_Integrity_Failures/',
|
|
98
64
|
},
|
|
99
65
|
'A09:2025': {
|
|
100
66
|
name: 'Logging & Alerting Failures',
|
|
101
67
|
description: 'Insufficient logging, detection, monitoring, and active response',
|
|
102
|
-
link: 'https://owasp.org/Top10/A09_2021-Security_Logging_and_Monitoring_Failures/',
|
|
68
|
+
link: 'https://owasp.org/Top10/A09_2021-Security_Logging_and_Monitoring_Failures/',
|
|
103
69
|
fallbackLink: 'https://owasp.org/Top10/A09_2021-Security_Logging_and_Monitoring_Failures/',
|
|
104
70
|
},
|
|
105
71
|
'A10:2025': {
|
|
106
72
|
name: 'Mishandling of Exceptional Conditions',
|
|
107
73
|
description: 'Improper error handling, uncaught exceptions, information leakage via errors',
|
|
108
|
-
link: 'https://owasp.org/Top10/A03_2021-Injection/',
|
|
74
|
+
link: 'https://owasp.org/Top10/A03_2021-Injection/',
|
|
109
75
|
fallbackLink: 'https://owasp.org/Top10/A03_2021-Injection/',
|
|
110
76
|
},
|
|
111
77
|
};
|
|
112
|
-
/**
|
|
113
|
-
* OWASP 2021 category details (legacy support)
|
|
114
|
-
*/
|
|
115
78
|
exports.OWASP_2021_DETAILS = {
|
|
116
79
|
'A01:2021': {
|
|
117
80
|
name: 'Broken Access Control',
|
|
@@ -164,10 +127,6 @@ exports.OWASP_2021_DETAILS = {
|
|
|
164
127
|
link: 'https://owasp.org/Top10/A10_2021-Server-Side_Request_Forgery_%28SSRF%29/',
|
|
165
128
|
},
|
|
166
129
|
};
|
|
167
|
-
/**
|
|
168
|
-
* OWASP Serverless Top 10 (SAS) category details
|
|
169
|
-
* @see https://owasp.org/www-project-serverless-top-10/
|
|
170
|
-
*/
|
|
171
130
|
exports.OWASP_SERVERLESS_DETAILS = {
|
|
172
131
|
'SAS-1': {
|
|
173
132
|
name: 'Function Event Data Injection',
|
|
@@ -220,42 +179,24 @@ exports.OWASP_SERVERLESS_DETAILS = {
|
|
|
220
179
|
link: 'https://owasp.org/www-project-serverless-top-10/',
|
|
221
180
|
},
|
|
222
181
|
};
|
|
223
|
-
/**
|
|
224
|
-
* Combined OWASP details (2025 + 2021 + Serverless)
|
|
225
|
-
*/
|
|
226
182
|
exports.OWASP_DETAILS = {
|
|
227
183
|
...exports.OWASP_2025_DETAILS,
|
|
228
184
|
...exports.OWASP_2021_DETAILS,
|
|
229
185
|
...exports.OWASP_SERVERLESS_DETAILS,
|
|
230
186
|
};
|
|
231
|
-
/**
|
|
232
|
-
* Maps 2021 categories to 2025 equivalents
|
|
233
|
-
*/
|
|
234
187
|
exports.OWASP_2021_TO_2025 = {
|
|
235
|
-
'A01:2021': 'A01:2025',
|
|
236
|
-
'A02:2021': 'A04:2025',
|
|
237
|
-
'A03:2021': 'A05:2025',
|
|
238
|
-
'A04:2021': 'A06:2025',
|
|
239
|
-
'A05:2021': 'A02:2025',
|
|
240
|
-
'A06:2021': 'A03:2025',
|
|
241
|
-
'A07:2021': 'A07:2025',
|
|
242
|
-
'A08:2021': 'A08:2025',
|
|
243
|
-
'A09:2021': 'A09:2025',
|
|
244
|
-
'A10:2021': 'A05:2025',
|
|
188
|
+
'A01:2021': 'A01:2025',
|
|
189
|
+
'A02:2021': 'A04:2025',
|
|
190
|
+
'A03:2021': 'A05:2025',
|
|
191
|
+
'A04:2021': 'A06:2025',
|
|
192
|
+
'A05:2021': 'A02:2025',
|
|
193
|
+
'A06:2021': 'A03:2025',
|
|
194
|
+
'A07:2021': 'A07:2025',
|
|
195
|
+
'A08:2021': 'A08:2025',
|
|
196
|
+
'A09:2021': 'A09:2025',
|
|
197
|
+
'A10:2021': 'A05:2025',
|
|
245
198
|
};
|
|
246
|
-
// ============================================================================
|
|
247
|
-
// CWE TO OWASP 2025/CVSS MAPPING (Updated for OWASP Top 10 2025)
|
|
248
|
-
// ============================================================================
|
|
249
|
-
/**
|
|
250
|
-
* Maps common CWE IDs to OWASP 2025 categories and typical CVSS scores
|
|
251
|
-
* This enables automatic enrichment of security rules
|
|
252
|
-
*
|
|
253
|
-
* @see https://owasp.org/Top10/2025/
|
|
254
|
-
*/
|
|
255
199
|
exports.CWE_MAPPING = {
|
|
256
|
-
// =========================================================================
|
|
257
|
-
// A01:2025 - Broken Access Control
|
|
258
|
-
// =========================================================================
|
|
259
200
|
'CWE-22': {
|
|
260
201
|
owasp: 'A01:2025',
|
|
261
202
|
cvss: 7.5,
|
|
@@ -316,9 +257,6 @@ exports.CWE_MAPPING = {
|
|
|
316
257
|
severity: 'CRITICAL',
|
|
317
258
|
name: 'Server-Side Request Forgery (SSRF)',
|
|
318
259
|
},
|
|
319
|
-
// =========================================================================
|
|
320
|
-
// A02:2025 - Security Misconfiguration
|
|
321
|
-
// =========================================================================
|
|
322
260
|
'CWE-16': {
|
|
323
261
|
owasp: 'A02:2025',
|
|
324
262
|
cvss: 5.3,
|
|
@@ -349,9 +287,6 @@ exports.CWE_MAPPING = {
|
|
|
349
287
|
severity: 'MEDIUM',
|
|
350
288
|
name: 'Sensitive Cookie with Improper SameSite',
|
|
351
289
|
},
|
|
352
|
-
// =========================================================================
|
|
353
|
-
// A03:2025 - Software Supply Chain Failures (NEW in 2025)
|
|
354
|
-
// =========================================================================
|
|
355
290
|
'CWE-426': {
|
|
356
291
|
owasp: 'A03:2025',
|
|
357
292
|
cvss: 7.5,
|
|
@@ -400,9 +335,6 @@ exports.CWE_MAPPING = {
|
|
|
400
335
|
severity: 'MEDIUM',
|
|
401
336
|
name: 'Unmaintainable Third-Party Components',
|
|
402
337
|
},
|
|
403
|
-
// =========================================================================
|
|
404
|
-
// A04:2025 - Cryptographic Failures
|
|
405
|
-
// =========================================================================
|
|
406
338
|
'CWE-327': {
|
|
407
339
|
owasp: 'A04:2025',
|
|
408
340
|
cvss: 7.5,
|
|
@@ -457,9 +389,6 @@ exports.CWE_MAPPING = {
|
|
|
457
389
|
severity: 'HIGH',
|
|
458
390
|
name: 'Missing Encryption of Sensitive Data',
|
|
459
391
|
},
|
|
460
|
-
// =========================================================================
|
|
461
|
-
// A05:2025 - Injection
|
|
462
|
-
// =========================================================================
|
|
463
392
|
'CWE-89': {
|
|
464
393
|
owasp: 'A05:2025',
|
|
465
394
|
cvss: 9.8,
|
|
@@ -520,9 +449,6 @@ exports.CWE_MAPPING = {
|
|
|
520
449
|
severity: 'CRITICAL',
|
|
521
450
|
name: 'XXE (XML External Entity)',
|
|
522
451
|
},
|
|
523
|
-
// =========================================================================
|
|
524
|
-
// A06:2025 - Insecure Design
|
|
525
|
-
// =========================================================================
|
|
526
452
|
'CWE-20': {
|
|
527
453
|
owasp: 'A06:2025',
|
|
528
454
|
cvss: 7.5,
|
|
@@ -565,9 +491,6 @@ exports.CWE_MAPPING = {
|
|
|
565
491
|
severity: 'MEDIUM',
|
|
566
492
|
name: 'Improper Control of Interaction Frequency',
|
|
567
493
|
},
|
|
568
|
-
// =========================================================================
|
|
569
|
-
// A07:2025 - Authentication Failures
|
|
570
|
-
// =========================================================================
|
|
571
494
|
'CWE-287': {
|
|
572
495
|
owasp: 'A07:2025',
|
|
573
496
|
cvss: 9.8,
|
|
@@ -610,9 +533,6 @@ exports.CWE_MAPPING = {
|
|
|
610
533
|
severity: 'MEDIUM',
|
|
611
534
|
name: 'Unverified Password Change',
|
|
612
535
|
},
|
|
613
|
-
// =========================================================================
|
|
614
|
-
// A08:2025 - Software or Data Integrity Failures
|
|
615
|
-
// =========================================================================
|
|
616
536
|
'CWE-345': {
|
|
617
537
|
owasp: 'A08:2025',
|
|
618
538
|
cvss: 7.5,
|
|
@@ -637,9 +557,6 @@ exports.CWE_MAPPING = {
|
|
|
637
557
|
severity: 'MEDIUM',
|
|
638
558
|
name: 'Missing Support for Integrity Check',
|
|
639
559
|
},
|
|
640
|
-
// =========================================================================
|
|
641
|
-
// A09:2025 - Logging & Alerting Failures
|
|
642
|
-
// =========================================================================
|
|
643
560
|
'CWE-117': {
|
|
644
561
|
owasp: 'A09:2025',
|
|
645
562
|
cvss: 5.3,
|
|
@@ -670,9 +587,6 @@ exports.CWE_MAPPING = {
|
|
|
670
587
|
severity: 'HIGH',
|
|
671
588
|
name: 'Logging of Excessive Data',
|
|
672
589
|
},
|
|
673
|
-
// =========================================================================
|
|
674
|
-
// A10:2025 - Mishandling of Exceptional Conditions (NEW in 2025)
|
|
675
|
-
// =========================================================================
|
|
676
590
|
'CWE-252': {
|
|
677
591
|
owasp: 'A10:2025',
|
|
678
592
|
cvss: 5.3,
|
|
@@ -722,79 +636,43 @@ exports.CWE_MAPPING = {
|
|
|
722
636
|
name: 'Improper Handling of Exceptional Conditions',
|
|
723
637
|
},
|
|
724
638
|
};
|
|
725
|
-
// ============================================================================
|
|
726
|
-
// COMPLIANCE FRAMEWORKS
|
|
727
|
-
// ============================================================================
|
|
728
|
-
/**
|
|
729
|
-
* Maps CWE categories to relevant compliance frameworks
|
|
730
|
-
*/
|
|
731
639
|
exports.CWE_COMPLIANCE_MAPPING = {
|
|
732
|
-
// Injection - All frameworks care about data integrity
|
|
733
640
|
'CWE-89': ['SOC2', 'PCI-DSS', 'HIPAA', 'ISO27001'],
|
|
734
641
|
'CWE-78': ['SOC2', 'PCI-DSS', 'ISO27001', 'NIST-CSF'],
|
|
735
642
|
'CWE-79': ['SOC2', 'PCI-DSS', 'GDPR', 'ISO27001'],
|
|
736
643
|
'CWE-94': ['SOC2', 'PCI-DSS', 'ISO27001'],
|
|
737
644
|
'CWE-95': ['SOC2', 'PCI-DSS', 'ISO27001'],
|
|
738
|
-
// Access Control - Critical for all frameworks
|
|
739
645
|
'CWE-22': ['SOC2', 'PCI-DSS', 'HIPAA', 'ISO27001'],
|
|
740
646
|
'CWE-269': ['SOC2', 'PCI-DSS', 'HIPAA', 'GDPR', 'ISO27001'],
|
|
741
647
|
'CWE-306': ['SOC2', 'PCI-DSS', 'HIPAA', 'GDPR', 'ISO27001', 'NIST-CSF'],
|
|
742
648
|
'CWE-862': ['SOC2', 'PCI-DSS', 'HIPAA', 'ISO27001'],
|
|
743
649
|
'CWE-915': ['SOC2', 'PCI-DSS', 'ISO27001'],
|
|
744
|
-
// Cryptographic - PCI-DSS, HIPAA especially strict
|
|
745
650
|
'CWE-327': ['PCI-DSS', 'HIPAA', 'ISO27001', 'NIST-CSF'],
|
|
746
651
|
'CWE-330': ['PCI-DSS', 'ISO27001'],
|
|
747
652
|
'CWE-798': ['SOC2', 'PCI-DSS', 'HIPAA', 'GDPR', 'ISO27001', 'NIST-CSF'],
|
|
748
|
-
// Data Protection - GDPR, HIPAA critical
|
|
749
653
|
'CWE-20': ['SOC2', 'PCI-DSS', 'HIPAA', 'GDPR', 'ISO27001'],
|
|
750
654
|
'CWE-200': ['GDPR', 'HIPAA', 'PCI-DSS', 'SOC2'],
|
|
751
655
|
'CWE-532': ['GDPR', 'HIPAA', 'PCI-DSS', 'SOC2'],
|
|
752
|
-
// Logging - SOC2, ISO27001 require logging
|
|
753
656
|
'CWE-778': ['SOC2', 'ISO27001', 'PCI-DSS', 'NIST-CSF'],
|
|
754
657
|
};
|
|
755
|
-
// ============================================================================
|
|
756
|
-
// ICON CONSTANTS
|
|
757
|
-
// ============================================================================
|
|
758
|
-
/**
|
|
759
|
-
* Common icon constants for consistency
|
|
760
|
-
*/
|
|
761
658
|
exports.MessageIcons = {
|
|
762
|
-
/** Security issues */
|
|
763
659
|
SECURITY: 'đ',
|
|
764
|
-
/** Warnings */
|
|
765
660
|
WARNING: 'â ī¸',
|
|
766
|
-
/** Package/dependency issues */
|
|
767
661
|
PACKAGE: 'đĻ',
|
|
768
|
-
/** Development practices */
|
|
769
662
|
DEVELOPMENT: 'đ§',
|
|
770
|
-
/** Performance issues */
|
|
771
663
|
PERFORMANCE: 'âĄ',
|
|
772
|
-
/** Accessibility issues */
|
|
773
664
|
ACCESSIBILITY: 'âŋ',
|
|
774
|
-
/** Code quality */
|
|
775
665
|
QUALITY: 'đ',
|
|
776
|
-
/** Architecture issues */
|
|
777
666
|
ARCHITECTURE: 'đī¸',
|
|
778
|
-
/** Migration/refactoring */
|
|
779
667
|
MIGRATION: 'đ',
|
|
780
|
-
/** Deprecation */
|
|
781
668
|
DEPRECATION: 'â',
|
|
782
|
-
/** Domain/DDD */
|
|
783
669
|
DOMAIN: 'đ',
|
|
784
|
-
/** Complexity */
|
|
785
670
|
COMPLEXITY: 'đ§ ',
|
|
786
|
-
/** Duplication */
|
|
787
671
|
DUPLICATION: 'đ',
|
|
788
|
-
/** Information/suggestions */
|
|
789
672
|
INFO: 'âšī¸',
|
|
790
|
-
/** Success/fix applied */
|
|
791
673
|
SUCCESS: 'â
',
|
|
792
|
-
/** Strategy/approach */
|
|
793
674
|
STRATEGY: 'đ¯',
|
|
794
|
-
/** Authentication */
|
|
795
675
|
AUTH: 'đ',
|
|
796
|
-
/** Data protection */
|
|
797
676
|
DATA: 'đĄī¸',
|
|
798
|
-
/** Compliance */
|
|
799
677
|
COMPLIANCE: 'đ',
|
|
800
678
|
};
|