Skip to content

Commit bc04597

Browse files
committed
Refactor category handling in ScanResults component to use simplified patternCategories structure
1 parent 8785fd7 commit bc04597

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

src/components/ScanResults.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ const ScanResults = ({ scanResults, onRefreshRequest }) => {
186186
) : null}
187187
{catNum ? (
188188
<span className="cve-category text-gray-600">
189-
Category: {Object.keys(patternCategories).find(k => patternCategories[k]?.id === catNum)} ({catNum})
189+
Category: {Object.keys(patternCategories).find(k => patternCategories[k] === catNum)} ({catNum})
190190
</span>
191191
) : null}
192192
</div>
@@ -260,7 +260,7 @@ const ScanResults = ({ scanResults, onRefreshRequest }) => {
260260
</pre>
261261
{catNum || subCat ? (
262262
<p className="text-xs text-gray-600 mt-2">
263-
Category: {Object.keys(patternCategories).find(k => patternCategories[k]?.id === catNum)} ({catNum})<br />
263+
Category: {Object.keys(patternCategories).find(k => patternCategories[k] === catNum)} ({catNum})<br />
264264
Subcategory: {subCat}
265265
</p>
266266
) : null}

src/lib/patterns/index.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,21 @@ const MAX_CONTEXT_LINES = 5; // Lines of context around matches
88

99
// Categories with CVSS mappings
1010
export const patternCategories = {
11-
CRITICAL_EXECUTION: { id: '94', cvss: 9.8 },
12-
AUTHENTICATION: { id: '287', cvss: 9.1 },
13-
INJECTION: { id: '74', cvss: 9.0 },
14-
FILE_OPERATIONS: { id: '434', cvss: 8.8 },
15-
CRYPTO_ISSUES: { id: '310', cvss: 7.4 },
16-
MEMORY_BUFFER: { id: '119', cvss: 7.3 },
17-
DATA_PROTECTION: { id: '200', cvss: 7.5 },
18-
INPUT_VALIDATION: { id: '20', cvss: 6.5 },
19-
ERROR_HANDLING: { id: '389', cvss: 5.0 },
20-
ACCESS_CONTROL: { id: '264', cvss: 8.2 },
21-
RESOURCE_MGMT: { id: '399', cvss: 7.1 },
22-
SSRF: { id: '918', cvss: 8.6 },
23-
SESSION_MANAGEMENT: { id: '384', cvss: 8.0 },
24-
API_SECURITY: { id: '920', cvss: 8.3 },
25-
DEPENDENCY_MANAGEMENT: { id: '925', cvss: 7.5 }
11+
CRITICAL_EXECUTION: '94',
12+
AUTHENTICATION: '287',
13+
INJECTION: '74',
14+
FILE_OPERATIONS: '434',
15+
CRYPTO_ISSUES: '310',
16+
MEMORY_BUFFER: '119',
17+
DATA_PROTECTION: '200',
18+
INPUT_VALIDATION: '20',
19+
ERROR_HANDLING: '389',
20+
ACCESS_CONTROL: '264',
21+
RESOURCE_MGMT: '399',
22+
SSRF: '918',
23+
SESSION_MANAGEMENT: '384',
24+
API_SECURITY: '920',
25+
DEPENDENCY_MANAGEMENT: '925'
2626
};
2727

2828
// Pattern validation

0 commit comments

Comments
 (0)