aiptx 2.0.7__py3-none-any.whl
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.
- aipt_v2/__init__.py +110 -0
- aipt_v2/__main__.py +24 -0
- aipt_v2/agents/AIPTxAgent/__init__.py +10 -0
- aipt_v2/agents/AIPTxAgent/aiptx_agent.py +211 -0
- aipt_v2/agents/__init__.py +46 -0
- aipt_v2/agents/base.py +520 -0
- aipt_v2/agents/exploit_agent.py +688 -0
- aipt_v2/agents/ptt.py +406 -0
- aipt_v2/agents/state.py +168 -0
- aipt_v2/app.py +957 -0
- aipt_v2/browser/__init__.py +31 -0
- aipt_v2/browser/automation.py +458 -0
- aipt_v2/browser/crawler.py +453 -0
- aipt_v2/cli.py +2933 -0
- aipt_v2/compliance/__init__.py +71 -0
- aipt_v2/compliance/compliance_report.py +449 -0
- aipt_v2/compliance/framework_mapper.py +424 -0
- aipt_v2/compliance/nist_mapping.py +345 -0
- aipt_v2/compliance/owasp_mapping.py +330 -0
- aipt_v2/compliance/pci_mapping.py +297 -0
- aipt_v2/config.py +341 -0
- aipt_v2/core/__init__.py +43 -0
- aipt_v2/core/agent.py +630 -0
- aipt_v2/core/llm.py +395 -0
- aipt_v2/core/memory.py +305 -0
- aipt_v2/core/ptt.py +329 -0
- aipt_v2/database/__init__.py +14 -0
- aipt_v2/database/models.py +232 -0
- aipt_v2/database/repository.py +384 -0
- aipt_v2/docker/__init__.py +23 -0
- aipt_v2/docker/builder.py +260 -0
- aipt_v2/docker/manager.py +222 -0
- aipt_v2/docker/sandbox.py +371 -0
- aipt_v2/evasion/__init__.py +58 -0
- aipt_v2/evasion/request_obfuscator.py +272 -0
- aipt_v2/evasion/tls_fingerprint.py +285 -0
- aipt_v2/evasion/ua_rotator.py +301 -0
- aipt_v2/evasion/waf_bypass.py +439 -0
- aipt_v2/execution/__init__.py +23 -0
- aipt_v2/execution/executor.py +302 -0
- aipt_v2/execution/parser.py +544 -0
- aipt_v2/execution/terminal.py +337 -0
- aipt_v2/health.py +437 -0
- aipt_v2/intelligence/__init__.py +194 -0
- aipt_v2/intelligence/adaptation.py +474 -0
- aipt_v2/intelligence/auth.py +520 -0
- aipt_v2/intelligence/chaining.py +775 -0
- aipt_v2/intelligence/correlation.py +536 -0
- aipt_v2/intelligence/cve_aipt.py +334 -0
- aipt_v2/intelligence/cve_info.py +1111 -0
- aipt_v2/intelligence/knowledge_graph.py +590 -0
- aipt_v2/intelligence/learning.py +626 -0
- aipt_v2/intelligence/llm_analyzer.py +502 -0
- aipt_v2/intelligence/llm_tool_selector.py +518 -0
- aipt_v2/intelligence/payload_generator.py +562 -0
- aipt_v2/intelligence/rag.py +239 -0
- aipt_v2/intelligence/scope.py +442 -0
- aipt_v2/intelligence/searchers/__init__.py +5 -0
- aipt_v2/intelligence/searchers/exploitdb_searcher.py +523 -0
- aipt_v2/intelligence/searchers/github_searcher.py +467 -0
- aipt_v2/intelligence/searchers/google_searcher.py +281 -0
- aipt_v2/intelligence/tools.json +443 -0
- aipt_v2/intelligence/triage.py +670 -0
- aipt_v2/interactive_shell.py +559 -0
- aipt_v2/interface/__init__.py +5 -0
- aipt_v2/interface/cli.py +230 -0
- aipt_v2/interface/main.py +501 -0
- aipt_v2/interface/tui.py +1276 -0
- aipt_v2/interface/utils.py +583 -0
- aipt_v2/llm/__init__.py +39 -0
- aipt_v2/llm/config.py +26 -0
- aipt_v2/llm/llm.py +514 -0
- aipt_v2/llm/memory.py +214 -0
- aipt_v2/llm/request_queue.py +89 -0
- aipt_v2/llm/utils.py +89 -0
- aipt_v2/local_tool_installer.py +1467 -0
- aipt_v2/models/__init__.py +15 -0
- aipt_v2/models/findings.py +295 -0
- aipt_v2/models/phase_result.py +224 -0
- aipt_v2/models/scan_config.py +207 -0
- aipt_v2/monitoring/grafana/dashboards/aipt-dashboard.json +355 -0
- aipt_v2/monitoring/grafana/dashboards/default.yml +17 -0
- aipt_v2/monitoring/grafana/datasources/prometheus.yml +17 -0
- aipt_v2/monitoring/prometheus.yml +60 -0
- aipt_v2/orchestration/__init__.py +52 -0
- aipt_v2/orchestration/pipeline.py +398 -0
- aipt_v2/orchestration/progress.py +300 -0
- aipt_v2/orchestration/scheduler.py +296 -0
- aipt_v2/orchestrator.py +2427 -0
- aipt_v2/payloads/__init__.py +27 -0
- aipt_v2/payloads/cmdi.py +150 -0
- aipt_v2/payloads/sqli.py +263 -0
- aipt_v2/payloads/ssrf.py +204 -0
- aipt_v2/payloads/templates.py +222 -0
- aipt_v2/payloads/traversal.py +166 -0
- aipt_v2/payloads/xss.py +204 -0
- aipt_v2/prompts/__init__.py +60 -0
- aipt_v2/proxy/__init__.py +29 -0
- aipt_v2/proxy/history.py +352 -0
- aipt_v2/proxy/interceptor.py +452 -0
- aipt_v2/recon/__init__.py +44 -0
- aipt_v2/recon/dns.py +241 -0
- aipt_v2/recon/osint.py +367 -0
- aipt_v2/recon/subdomain.py +372 -0
- aipt_v2/recon/tech_detect.py +311 -0
- aipt_v2/reports/__init__.py +17 -0
- aipt_v2/reports/generator.py +313 -0
- aipt_v2/reports/html_report.py +378 -0
- aipt_v2/runtime/__init__.py +53 -0
- aipt_v2/runtime/base.py +30 -0
- aipt_v2/runtime/docker.py +401 -0
- aipt_v2/runtime/local.py +346 -0
- aipt_v2/runtime/tool_server.py +205 -0
- aipt_v2/runtime/vps.py +830 -0
- aipt_v2/scanners/__init__.py +28 -0
- aipt_v2/scanners/base.py +273 -0
- aipt_v2/scanners/nikto.py +244 -0
- aipt_v2/scanners/nmap.py +402 -0
- aipt_v2/scanners/nuclei.py +273 -0
- aipt_v2/scanners/web.py +454 -0
- aipt_v2/scripts/security_audit.py +366 -0
- aipt_v2/setup_wizard.py +941 -0
- aipt_v2/skills/__init__.py +80 -0
- aipt_v2/skills/agents/__init__.py +14 -0
- aipt_v2/skills/agents/api_tester.py +706 -0
- aipt_v2/skills/agents/base.py +477 -0
- aipt_v2/skills/agents/code_review.py +459 -0
- aipt_v2/skills/agents/security_agent.py +336 -0
- aipt_v2/skills/agents/web_pentest.py +818 -0
- aipt_v2/skills/prompts/__init__.py +647 -0
- aipt_v2/system_detector.py +539 -0
- aipt_v2/telemetry/__init__.py +7 -0
- aipt_v2/telemetry/tracer.py +347 -0
- aipt_v2/terminal/__init__.py +28 -0
- aipt_v2/terminal/executor.py +400 -0
- aipt_v2/terminal/sandbox.py +350 -0
- aipt_v2/tools/__init__.py +44 -0
- aipt_v2/tools/active_directory/__init__.py +78 -0
- aipt_v2/tools/active_directory/ad_config.py +238 -0
- aipt_v2/tools/active_directory/bloodhound_wrapper.py +447 -0
- aipt_v2/tools/active_directory/kerberos_attacks.py +430 -0
- aipt_v2/tools/active_directory/ldap_enum.py +533 -0
- aipt_v2/tools/active_directory/smb_attacks.py +505 -0
- aipt_v2/tools/agents_graph/__init__.py +19 -0
- aipt_v2/tools/agents_graph/agents_graph_actions.py +69 -0
- aipt_v2/tools/api_security/__init__.py +76 -0
- aipt_v2/tools/api_security/api_discovery.py +608 -0
- aipt_v2/tools/api_security/graphql_scanner.py +622 -0
- aipt_v2/tools/api_security/jwt_analyzer.py +577 -0
- aipt_v2/tools/api_security/openapi_fuzzer.py +761 -0
- aipt_v2/tools/browser/__init__.py +5 -0
- aipt_v2/tools/browser/browser_actions.py +238 -0
- aipt_v2/tools/browser/browser_instance.py +535 -0
- aipt_v2/tools/browser/tab_manager.py +344 -0
- aipt_v2/tools/cloud/__init__.py +70 -0
- aipt_v2/tools/cloud/cloud_config.py +273 -0
- aipt_v2/tools/cloud/cloud_scanner.py +639 -0
- aipt_v2/tools/cloud/prowler_tool.py +571 -0
- aipt_v2/tools/cloud/scoutsuite_tool.py +359 -0
- aipt_v2/tools/executor.py +307 -0
- aipt_v2/tools/parser.py +408 -0
- aipt_v2/tools/proxy/__init__.py +5 -0
- aipt_v2/tools/proxy/proxy_actions.py +103 -0
- aipt_v2/tools/proxy/proxy_manager.py +789 -0
- aipt_v2/tools/registry.py +196 -0
- aipt_v2/tools/scanners/__init__.py +343 -0
- aipt_v2/tools/scanners/acunetix_tool.py +712 -0
- aipt_v2/tools/scanners/burp_tool.py +631 -0
- aipt_v2/tools/scanners/config.py +156 -0
- aipt_v2/tools/scanners/nessus_tool.py +588 -0
- aipt_v2/tools/scanners/zap_tool.py +612 -0
- aipt_v2/tools/terminal/__init__.py +5 -0
- aipt_v2/tools/terminal/terminal_actions.py +37 -0
- aipt_v2/tools/terminal/terminal_manager.py +153 -0
- aipt_v2/tools/terminal/terminal_session.py +449 -0
- aipt_v2/tools/tool_processing.py +108 -0
- aipt_v2/utils/__init__.py +17 -0
- aipt_v2/utils/logging.py +202 -0
- aipt_v2/utils/model_manager.py +187 -0
- aipt_v2/utils/searchers/__init__.py +269 -0
- aipt_v2/verify_install.py +793 -0
- aiptx-2.0.7.dist-info/METADATA +345 -0
- aiptx-2.0.7.dist-info/RECORD +187 -0
- aiptx-2.0.7.dist-info/WHEEL +5 -0
- aiptx-2.0.7.dist-info/entry_points.txt +7 -0
- aiptx-2.0.7.dist-info/licenses/LICENSE +21 -0
- aiptx-2.0.7.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
"""
|
|
2
|
+
NIST 800-53 Mapping
|
|
3
|
+
|
|
4
|
+
NIST Special Publication 800-53 Security Controls mapping.
|
|
5
|
+
Maps CWEs to NIST control families.
|
|
6
|
+
|
|
7
|
+
Usage:
|
|
8
|
+
from aipt_v2.compliance import NISTMapper, get_nist_control
|
|
9
|
+
|
|
10
|
+
control = get_nist_control("CWE-89") # Returns "SI-10"
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
from dataclasses import dataclass, field
|
|
14
|
+
from typing import List, Dict, Optional
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@dataclass
|
|
18
|
+
class NISTControl:
|
|
19
|
+
"""NIST 800-53 control definition."""
|
|
20
|
+
id: str
|
|
21
|
+
family: str
|
|
22
|
+
name: str
|
|
23
|
+
description: str
|
|
24
|
+
cwes: List[str]
|
|
25
|
+
related_controls: List[str]
|
|
26
|
+
priority: str # P1, P2, P3
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
# NIST 800-53 Rev 5 Controls (security-relevant subset)
|
|
30
|
+
NIST_CONTROLS = {
|
|
31
|
+
# Access Control (AC) Family
|
|
32
|
+
"AC-2": NISTControl(
|
|
33
|
+
id="AC-2",
|
|
34
|
+
family="Access Control",
|
|
35
|
+
name="Account Management",
|
|
36
|
+
description="Manage system accounts, including establishing, activating, "
|
|
37
|
+
"modifying, disabling, and removing accounts.",
|
|
38
|
+
cwes=["CWE-287", "CWE-306"],
|
|
39
|
+
related_controls=["AC-3", "AC-5", "AC-6", "IA-2"],
|
|
40
|
+
priority="P1"
|
|
41
|
+
),
|
|
42
|
+
|
|
43
|
+
"AC-3": NISTControl(
|
|
44
|
+
id="AC-3",
|
|
45
|
+
family="Access Control",
|
|
46
|
+
name="Access Enforcement",
|
|
47
|
+
description="Enforce approved authorizations for logical access to information "
|
|
48
|
+
"and system resources.",
|
|
49
|
+
cwes=["CWE-284", "CWE-862", "CWE-639", "CWE-285"],
|
|
50
|
+
related_controls=["AC-2", "AC-5", "AC-6", "AC-17", "AC-21"],
|
|
51
|
+
priority="P1"
|
|
52
|
+
),
|
|
53
|
+
|
|
54
|
+
"AC-6": NISTControl(
|
|
55
|
+
id="AC-6",
|
|
56
|
+
family="Access Control",
|
|
57
|
+
name="Least Privilege",
|
|
58
|
+
description="Employ the principle of least privilege, allowing only authorized "
|
|
59
|
+
"accesses for users which are necessary to accomplish assigned tasks.",
|
|
60
|
+
cwes=["CWE-863", "CWE-269", "CWE-250"],
|
|
61
|
+
related_controls=["AC-2", "AC-3", "AC-5", "CM-11", "PL-2"],
|
|
62
|
+
priority="P1"
|
|
63
|
+
),
|
|
64
|
+
|
|
65
|
+
"AC-17": NISTControl(
|
|
66
|
+
id="AC-17",
|
|
67
|
+
family="Access Control",
|
|
68
|
+
name="Remote Access",
|
|
69
|
+
description="Establish usage restrictions, configuration requirements, and "
|
|
70
|
+
"implementation guidance for each type of remote access allowed.",
|
|
71
|
+
cwes=["CWE-287", "CWE-294", "CWE-300"],
|
|
72
|
+
related_controls=["AC-2", "AC-3", "AC-4", "AC-18", "IA-2"],
|
|
73
|
+
priority="P1"
|
|
74
|
+
),
|
|
75
|
+
|
|
76
|
+
# Audit and Accountability (AU) Family
|
|
77
|
+
"AU-2": NISTControl(
|
|
78
|
+
id="AU-2",
|
|
79
|
+
family="Audit and Accountability",
|
|
80
|
+
name="Audit Events",
|
|
81
|
+
description="Determine that the system is capable of auditing defined events "
|
|
82
|
+
"and coordinate the audit function with other entities.",
|
|
83
|
+
cwes=["CWE-778", "CWE-779"],
|
|
84
|
+
related_controls=["AU-3", "AU-6", "AU-12", "SI-4"],
|
|
85
|
+
priority="P1"
|
|
86
|
+
),
|
|
87
|
+
|
|
88
|
+
"AU-3": NISTControl(
|
|
89
|
+
id="AU-3",
|
|
90
|
+
family="Audit and Accountability",
|
|
91
|
+
name="Content of Audit Records",
|
|
92
|
+
description="Ensure that audit records contain information that establishes "
|
|
93
|
+
"what type of event occurred, when and where it occurred, and source.",
|
|
94
|
+
cwes=["CWE-223", "CWE-779"],
|
|
95
|
+
related_controls=["AU-2", "AU-8", "AU-12", "SI-11"],
|
|
96
|
+
priority="P1"
|
|
97
|
+
),
|
|
98
|
+
|
|
99
|
+
"AU-9": NISTControl(
|
|
100
|
+
id="AU-9",
|
|
101
|
+
family="Audit and Accountability",
|
|
102
|
+
name="Protection of Audit Information",
|
|
103
|
+
description="Protect audit information and audit tools from unauthorized access, "
|
|
104
|
+
"modification, and deletion.",
|
|
105
|
+
cwes=["CWE-117", "CWE-532"],
|
|
106
|
+
related_controls=["AC-3", "AU-4", "AU-11", "SC-28"],
|
|
107
|
+
priority="P1"
|
|
108
|
+
),
|
|
109
|
+
|
|
110
|
+
# Configuration Management (CM) Family
|
|
111
|
+
"CM-6": NISTControl(
|
|
112
|
+
id="CM-6",
|
|
113
|
+
family="Configuration Management",
|
|
114
|
+
name="Configuration Settings",
|
|
115
|
+
description="Establish and document mandatory configuration settings for system "
|
|
116
|
+
"components using security configuration checklists.",
|
|
117
|
+
cwes=["CWE-16", "CWE-260", "CWE-611", "CWE-756", "CWE-1188"],
|
|
118
|
+
related_controls=["AC-19", "CM-2", "CM-3", "CM-7", "SI-4"],
|
|
119
|
+
priority="P1"
|
|
120
|
+
),
|
|
121
|
+
|
|
122
|
+
"CM-7": NISTControl(
|
|
123
|
+
id="CM-7",
|
|
124
|
+
family="Configuration Management",
|
|
125
|
+
name="Least Functionality",
|
|
126
|
+
description="Configure the system to provide only essential capabilities and "
|
|
127
|
+
"prohibit or restrict the use of functions, ports, protocols, and services.",
|
|
128
|
+
cwes=["CWE-1188", "CWE-489"],
|
|
129
|
+
related_controls=["AC-6", "CM-2", "CM-6", "SA-5"],
|
|
130
|
+
priority="P1"
|
|
131
|
+
),
|
|
132
|
+
|
|
133
|
+
# Identification and Authentication (IA) Family
|
|
134
|
+
"IA-2": NISTControl(
|
|
135
|
+
id="IA-2",
|
|
136
|
+
family="Identification and Authentication",
|
|
137
|
+
name="Identification and Authentication (Organizational Users)",
|
|
138
|
+
description="Uniquely identify and authenticate organizational users and "
|
|
139
|
+
"associate that unique identification with processes acting on behalf.",
|
|
140
|
+
cwes=["CWE-287", "CWE-306", "CWE-290"],
|
|
141
|
+
related_controls=["AC-2", "AC-3", "AC-14", "IA-4", "IA-5"],
|
|
142
|
+
priority="P1"
|
|
143
|
+
),
|
|
144
|
+
|
|
145
|
+
"IA-5": NISTControl(
|
|
146
|
+
id="IA-5",
|
|
147
|
+
family="Identification and Authentication",
|
|
148
|
+
name="Authenticator Management",
|
|
149
|
+
description="Manage system authenticators by verifying identity before "
|
|
150
|
+
"establishing new authenticators and establishing procedures for "
|
|
151
|
+
"lost or compromised authenticators.",
|
|
152
|
+
cwes=["CWE-521", "CWE-798", "CWE-259", "CWE-307", "CWE-620"],
|
|
153
|
+
related_controls=["AC-20", "IA-2", "IA-4", "IA-8"],
|
|
154
|
+
priority="P1"
|
|
155
|
+
),
|
|
156
|
+
|
|
157
|
+
"IA-8": NISTControl(
|
|
158
|
+
id="IA-8",
|
|
159
|
+
family="Identification and Authentication",
|
|
160
|
+
name="Identification and Authentication (Non-Organizational Users)",
|
|
161
|
+
description="Uniquely identify and authenticate non-organizational users.",
|
|
162
|
+
cwes=["CWE-287", "CWE-384"],
|
|
163
|
+
related_controls=["AC-14", "IA-2", "IA-4", "IA-5"],
|
|
164
|
+
priority="P1"
|
|
165
|
+
),
|
|
166
|
+
|
|
167
|
+
# Risk Assessment (RA) Family
|
|
168
|
+
"RA-5": NISTControl(
|
|
169
|
+
id="RA-5",
|
|
170
|
+
family="Risk Assessment",
|
|
171
|
+
name="Vulnerability Scanning",
|
|
172
|
+
description="Scan for vulnerabilities in the system and hosted applications "
|
|
173
|
+
"and when new vulnerabilities are identified and reported.",
|
|
174
|
+
cwes=["CWE-937", "CWE-1104", "CWE-1035"],
|
|
175
|
+
related_controls=["CA-2", "CA-7", "PM-15", "RA-3", "SI-2"],
|
|
176
|
+
priority="P1"
|
|
177
|
+
),
|
|
178
|
+
|
|
179
|
+
# System and Communications Protection (SC) Family
|
|
180
|
+
"SC-8": NISTControl(
|
|
181
|
+
id="SC-8",
|
|
182
|
+
family="System and Communications Protection",
|
|
183
|
+
name="Transmission Confidentiality and Integrity",
|
|
184
|
+
description="Protect the confidentiality and integrity of transmitted information.",
|
|
185
|
+
cwes=["CWE-319", "CWE-523"],
|
|
186
|
+
related_controls=["AC-17", "PE-4", "SC-12", "SC-13", "SC-23"],
|
|
187
|
+
priority="P1"
|
|
188
|
+
),
|
|
189
|
+
|
|
190
|
+
"SC-12": NISTControl(
|
|
191
|
+
id="SC-12",
|
|
192
|
+
family="System and Communications Protection",
|
|
193
|
+
name="Cryptographic Key Establishment and Management",
|
|
194
|
+
description="Establish and manage cryptographic keys when cryptography is "
|
|
195
|
+
"employed within the system.",
|
|
196
|
+
cwes=["CWE-320", "CWE-321", "CWE-326"],
|
|
197
|
+
related_controls=["SC-13", "SC-17"],
|
|
198
|
+
priority="P1"
|
|
199
|
+
),
|
|
200
|
+
|
|
201
|
+
"SC-13": NISTControl(
|
|
202
|
+
id="SC-13",
|
|
203
|
+
family="System and Communications Protection",
|
|
204
|
+
name="Cryptographic Protection",
|
|
205
|
+
description="Implement cryptographic mechanisms in accordance with applicable "
|
|
206
|
+
"laws, policies, and standards.",
|
|
207
|
+
cwes=["CWE-327", "CWE-328", "CWE-330", "CWE-338"],
|
|
208
|
+
related_controls=["SC-8", "SC-12", "SC-28"],
|
|
209
|
+
priority="P1"
|
|
210
|
+
),
|
|
211
|
+
|
|
212
|
+
"SC-28": NISTControl(
|
|
213
|
+
id="SC-28",
|
|
214
|
+
family="System and Communications Protection",
|
|
215
|
+
name="Protection of Information at Rest",
|
|
216
|
+
description="Protect the confidentiality and integrity of information at rest.",
|
|
217
|
+
cwes=["CWE-311", "CWE-312", "CWE-313"],
|
|
218
|
+
related_controls=["AC-3", "SC-8", "SC-12", "SC-13"],
|
|
219
|
+
priority="P1"
|
|
220
|
+
),
|
|
221
|
+
|
|
222
|
+
# System and Information Integrity (SI) Family
|
|
223
|
+
"SI-2": NISTControl(
|
|
224
|
+
id="SI-2",
|
|
225
|
+
family="System and Information Integrity",
|
|
226
|
+
name="Flaw Remediation",
|
|
227
|
+
description="Identify, report, and correct system flaws; test software and "
|
|
228
|
+
"firmware updates related to flaw remediation.",
|
|
229
|
+
cwes=["CWE-937", "CWE-1104"],
|
|
230
|
+
related_controls=["CA-5", "CM-3", "CM-6", "RA-5", "SI-11"],
|
|
231
|
+
priority="P1"
|
|
232
|
+
),
|
|
233
|
+
|
|
234
|
+
"SI-10": NISTControl(
|
|
235
|
+
id="SI-10",
|
|
236
|
+
family="System and Information Integrity",
|
|
237
|
+
name="Information Input Validation",
|
|
238
|
+
description="Check the validity of information inputs.",
|
|
239
|
+
cwes=["CWE-20", "CWE-79", "CWE-89", "CWE-78", "CWE-94", "CWE-502", "CWE-918",
|
|
240
|
+
"CWE-22", "CWE-434", "CWE-77", "CWE-74"],
|
|
241
|
+
related_controls=["SI-15"],
|
|
242
|
+
priority="P1"
|
|
243
|
+
),
|
|
244
|
+
|
|
245
|
+
"SI-11": NISTControl(
|
|
246
|
+
id="SI-11",
|
|
247
|
+
family="System and Information Integrity",
|
|
248
|
+
name="Error Handling",
|
|
249
|
+
description="Generate error messages that provide information necessary for "
|
|
250
|
+
"corrective actions without revealing information that could be exploited.",
|
|
251
|
+
cwes=["CWE-209", "CWE-200"],
|
|
252
|
+
related_controls=["AU-3", "AU-9", "SC-31", "SI-2"],
|
|
253
|
+
priority="P2"
|
|
254
|
+
)
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
class NISTMapper:
|
|
259
|
+
"""NIST 800-53 specific mapper."""
|
|
260
|
+
|
|
261
|
+
def __init__(self):
|
|
262
|
+
self.controls = NIST_CONTROLS
|
|
263
|
+
|
|
264
|
+
def get_control(self, cwe_id: str) -> Optional[NISTControl]:
|
|
265
|
+
"""Get NIST control for a CWE."""
|
|
266
|
+
cwe_id = cwe_id.upper()
|
|
267
|
+
if not cwe_id.startswith("CWE-"):
|
|
268
|
+
cwe_id = f"CWE-{cwe_id}"
|
|
269
|
+
|
|
270
|
+
for control in self.controls.values():
|
|
271
|
+
if cwe_id in control.cwes:
|
|
272
|
+
return control
|
|
273
|
+
|
|
274
|
+
return None
|
|
275
|
+
|
|
276
|
+
def get_control_by_id(self, control_id: str) -> Optional[NISTControl]:
|
|
277
|
+
"""Get NIST control by ID."""
|
|
278
|
+
return self.controls.get(control_id.upper())
|
|
279
|
+
|
|
280
|
+
def get_controls_by_family(self, family: str) -> List[NISTControl]:
|
|
281
|
+
"""Get all controls in a family."""
|
|
282
|
+
return [c for c in self.controls.values()
|
|
283
|
+
if family.lower() in c.family.lower()]
|
|
284
|
+
|
|
285
|
+
def get_all_controls_for_cwe(self, cwe_id: str) -> List[NISTControl]:
|
|
286
|
+
"""Get all NIST controls mapped to a CWE."""
|
|
287
|
+
cwe_id = cwe_id.upper()
|
|
288
|
+
if not cwe_id.startswith("CWE-"):
|
|
289
|
+
cwe_id = f"CWE-{cwe_id}"
|
|
290
|
+
|
|
291
|
+
controls = []
|
|
292
|
+
for control in self.controls.values():
|
|
293
|
+
if cwe_id in control.cwes:
|
|
294
|
+
controls.append(control)
|
|
295
|
+
|
|
296
|
+
return controls
|
|
297
|
+
|
|
298
|
+
def get_compliance_status(self, findings: List[Dict]) -> Dict[str, Dict]:
|
|
299
|
+
"""
|
|
300
|
+
Calculate NIST compliance status based on findings.
|
|
301
|
+
|
|
302
|
+
Args:
|
|
303
|
+
findings: List of findings with CWE IDs
|
|
304
|
+
|
|
305
|
+
Returns:
|
|
306
|
+
Dict with compliance status per control
|
|
307
|
+
"""
|
|
308
|
+
status = {}
|
|
309
|
+
|
|
310
|
+
for control_id, control in self.controls.items():
|
|
311
|
+
affected_cwes = []
|
|
312
|
+
for finding in findings:
|
|
313
|
+
cwe = finding.get("cwe", finding.get("cwe_id", ""))
|
|
314
|
+
cwe_normalized = cwe.upper()
|
|
315
|
+
if not cwe_normalized.startswith("CWE-"):
|
|
316
|
+
cwe_normalized = f"CWE-{cwe_normalized}"
|
|
317
|
+
|
|
318
|
+
if cwe_normalized in control.cwes:
|
|
319
|
+
affected_cwes.append(cwe)
|
|
320
|
+
|
|
321
|
+
status[control_id] = {
|
|
322
|
+
"control_name": control.name,
|
|
323
|
+
"family": control.family,
|
|
324
|
+
"compliant": len(affected_cwes) == 0,
|
|
325
|
+
"findings_count": len(affected_cwes),
|
|
326
|
+
"affected_cwes": affected_cwes,
|
|
327
|
+
"priority": control.priority
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
return status
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
def get_nist_control(cwe_id: str) -> Optional[str]:
|
|
334
|
+
"""
|
|
335
|
+
Get NIST control ID for a CWE.
|
|
336
|
+
|
|
337
|
+
Args:
|
|
338
|
+
cwe_id: CWE identifier
|
|
339
|
+
|
|
340
|
+
Returns:
|
|
341
|
+
NIST control ID or None
|
|
342
|
+
"""
|
|
343
|
+
mapper = NISTMapper()
|
|
344
|
+
control = mapper.get_control(cwe_id)
|
|
345
|
+
return control.id if control else None
|
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
"""
|
|
2
|
+
OWASP Top 10 2021 Mapping
|
|
3
|
+
|
|
4
|
+
Provides detailed OWASP Top 10 2021 category definitions
|
|
5
|
+
and CWE-to-OWASP mapping.
|
|
6
|
+
|
|
7
|
+
Usage:
|
|
8
|
+
from aipt_v2.compliance import OWASPMapper, get_owasp_category
|
|
9
|
+
|
|
10
|
+
category = get_owasp_category("CWE-79") # Returns A03
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
from dataclasses import dataclass, field
|
|
14
|
+
from typing import List, Dict, Optional
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@dataclass
|
|
18
|
+
class OWASPCategory:
|
|
19
|
+
"""OWASP Top 10 category definition."""
|
|
20
|
+
id: str
|
|
21
|
+
name: str
|
|
22
|
+
description: str
|
|
23
|
+
cwes: List[str]
|
|
24
|
+
risk_factors: Dict[str, str]
|
|
25
|
+
prevention: List[str]
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
# OWASP Top 10 2021 definitions
|
|
29
|
+
OWASP_TOP_10 = {
|
|
30
|
+
"A01": OWASPCategory(
|
|
31
|
+
id="A01:2021",
|
|
32
|
+
name="Broken Access Control",
|
|
33
|
+
description="Access control enforces policy such that users cannot act outside "
|
|
34
|
+
"of their intended permissions. Failures typically lead to unauthorized "
|
|
35
|
+
"information disclosure, modification, or destruction of all data or "
|
|
36
|
+
"performing a business function outside the user's limits.",
|
|
37
|
+
cwes=["CWE-22", "CWE-23", "CWE-35", "CWE-59", "CWE-200", "CWE-201", "CWE-219",
|
|
38
|
+
"CWE-264", "CWE-275", "CWE-276", "CWE-284", "CWE-285", "CWE-352", "CWE-359",
|
|
39
|
+
"CWE-377", "CWE-402", "CWE-425", "CWE-441", "CWE-497", "CWE-538", "CWE-540",
|
|
40
|
+
"CWE-548", "CWE-552", "CWE-566", "CWE-601", "CWE-639", "CWE-651", "CWE-668",
|
|
41
|
+
"CWE-706", "CWE-862", "CWE-863", "CWE-913", "CWE-922", "CWE-1275"],
|
|
42
|
+
risk_factors={
|
|
43
|
+
"threat_agents": "Anyone with network access",
|
|
44
|
+
"exploitability": "Average",
|
|
45
|
+
"prevalence": "Widespread",
|
|
46
|
+
"detectability": "Average",
|
|
47
|
+
"impact": "Severe"
|
|
48
|
+
},
|
|
49
|
+
prevention=[
|
|
50
|
+
"Except for public resources, deny by default",
|
|
51
|
+
"Implement access control mechanisms once and re-use them",
|
|
52
|
+
"Enforce record ownership, rather than accepting that the user can create, read, update, or delete any record",
|
|
53
|
+
"Disable web server directory listing and ensure file metadata and backup files are not present",
|
|
54
|
+
"Log access control failures, alert admins when appropriate",
|
|
55
|
+
"Rate limit API and controller access to minimize harm from automated attack tooling",
|
|
56
|
+
"Invalidate JWT tokens on the server after logout"
|
|
57
|
+
]
|
|
58
|
+
),
|
|
59
|
+
|
|
60
|
+
"A02": OWASPCategory(
|
|
61
|
+
id="A02:2021",
|
|
62
|
+
name="Cryptographic Failures",
|
|
63
|
+
description="Failures related to cryptography (or lack thereof) which often lead "
|
|
64
|
+
"to exposure of sensitive data. This includes exposure of sensitive data "
|
|
65
|
+
"that requires protection, such as passwords, credit card numbers, health "
|
|
66
|
+
"records, personal information.",
|
|
67
|
+
cwes=["CWE-261", "CWE-296", "CWE-310", "CWE-319", "CWE-320", "CWE-321", "CWE-322",
|
|
68
|
+
"CWE-323", "CWE-324", "CWE-325", "CWE-326", "CWE-327", "CWE-328", "CWE-329",
|
|
69
|
+
"CWE-330", "CWE-331", "CWE-335", "CWE-336", "CWE-337", "CWE-338", "CWE-340",
|
|
70
|
+
"CWE-347", "CWE-523", "CWE-720", "CWE-757", "CWE-759", "CWE-760", "CWE-780",
|
|
71
|
+
"CWE-818", "CWE-916"],
|
|
72
|
+
risk_factors={
|
|
73
|
+
"threat_agents": "Attackers with access to data in transit/at rest",
|
|
74
|
+
"exploitability": "Average",
|
|
75
|
+
"prevalence": "Widespread",
|
|
76
|
+
"detectability": "Average",
|
|
77
|
+
"impact": "Severe"
|
|
78
|
+
},
|
|
79
|
+
prevention=[
|
|
80
|
+
"Classify data processed, stored, or transmitted by an application",
|
|
81
|
+
"Don't store sensitive data unnecessarily. Discard it as soon as possible",
|
|
82
|
+
"Make sure to encrypt all sensitive data at rest",
|
|
83
|
+
"Ensure up-to-date and strong standard algorithms, protocols, and keys are in place",
|
|
84
|
+
"Encrypt all data in transit with secure protocols such as TLS",
|
|
85
|
+
"Disable caching for responses that contain sensitive data",
|
|
86
|
+
"Do not use legacy protocols such as FTP and SMTP for transporting sensitive data"
|
|
87
|
+
]
|
|
88
|
+
),
|
|
89
|
+
|
|
90
|
+
"A03": OWASPCategory(
|
|
91
|
+
id="A03:2021",
|
|
92
|
+
name="Injection",
|
|
93
|
+
description="User-supplied data is not validated, filtered, or sanitized by the "
|
|
94
|
+
"application. Dynamic queries or non-parameterized calls without "
|
|
95
|
+
"context-aware escaping are used directly in the interpreter.",
|
|
96
|
+
cwes=["CWE-20", "CWE-74", "CWE-75", "CWE-77", "CWE-78", "CWE-79", "CWE-80",
|
|
97
|
+
"CWE-83", "CWE-87", "CWE-88", "CWE-89", "CWE-90", "CWE-91", "CWE-93",
|
|
98
|
+
"CWE-94", "CWE-95", "CWE-96", "CWE-97", "CWE-98", "CWE-99", "CWE-113",
|
|
99
|
+
"CWE-116", "CWE-138", "CWE-184", "CWE-470", "CWE-471", "CWE-564", "CWE-610",
|
|
100
|
+
"CWE-643", "CWE-644", "CWE-652", "CWE-917"],
|
|
101
|
+
risk_factors={
|
|
102
|
+
"threat_agents": "Anyone who can send untrusted data",
|
|
103
|
+
"exploitability": "Easy",
|
|
104
|
+
"prevalence": "Common",
|
|
105
|
+
"detectability": "Easy",
|
|
106
|
+
"impact": "Severe"
|
|
107
|
+
},
|
|
108
|
+
prevention=[
|
|
109
|
+
"Use a safe API which avoids using the interpreter entirely",
|
|
110
|
+
"Use positive server-side input validation",
|
|
111
|
+
"Use LIMIT and other SQL controls to prevent mass disclosure",
|
|
112
|
+
"Use parameterized queries and stored procedures",
|
|
113
|
+
"Escape special characters using the specific escape syntax"
|
|
114
|
+
]
|
|
115
|
+
),
|
|
116
|
+
|
|
117
|
+
"A04": OWASPCategory(
|
|
118
|
+
id="A04:2021",
|
|
119
|
+
name="Insecure Design",
|
|
120
|
+
description="Insecure design is a broad category representing different weaknesses, "
|
|
121
|
+
"expressed as 'missing or ineffective control design.' This category "
|
|
122
|
+
"focuses on risks related to design and architectural flaws.",
|
|
123
|
+
cwes=["CWE-73", "CWE-183", "CWE-209", "CWE-213", "CWE-235", "CWE-256", "CWE-257",
|
|
124
|
+
"CWE-266", "CWE-269", "CWE-280", "CWE-311", "CWE-312", "CWE-313", "CWE-316",
|
|
125
|
+
"CWE-419", "CWE-430", "CWE-434", "CWE-444", "CWE-451", "CWE-472", "CWE-501",
|
|
126
|
+
"CWE-522", "CWE-525", "CWE-539", "CWE-579", "CWE-598", "CWE-602", "CWE-642",
|
|
127
|
+
"CWE-646", "CWE-650", "CWE-653", "CWE-656", "CWE-657", "CWE-799", "CWE-807",
|
|
128
|
+
"CWE-840", "CWE-841", "CWE-927", "CWE-1021", "CWE-1173"],
|
|
129
|
+
risk_factors={
|
|
130
|
+
"threat_agents": "Varies based on design flaw",
|
|
131
|
+
"exploitability": "Average",
|
|
132
|
+
"prevalence": "Common",
|
|
133
|
+
"detectability": "Difficult",
|
|
134
|
+
"impact": "Moderate to Severe"
|
|
135
|
+
},
|
|
136
|
+
prevention=[
|
|
137
|
+
"Establish and use a secure development lifecycle",
|
|
138
|
+
"Use threat modeling for critical authentication and access control",
|
|
139
|
+
"Integrate security language and controls into user stories",
|
|
140
|
+
"Write unit and integration tests to validate security controls",
|
|
141
|
+
"Tier application and network layers for critical applications"
|
|
142
|
+
]
|
|
143
|
+
),
|
|
144
|
+
|
|
145
|
+
"A05": OWASPCategory(
|
|
146
|
+
id="A05:2021",
|
|
147
|
+
name="Security Misconfiguration",
|
|
148
|
+
description="The application might be vulnerable if missing appropriate security "
|
|
149
|
+
"hardening or having improperly configured permissions on cloud services. "
|
|
150
|
+
"Default configurations, incomplete or ad hoc configurations.",
|
|
151
|
+
cwes=["CWE-2", "CWE-11", "CWE-13", "CWE-15", "CWE-16", "CWE-260", "CWE-315",
|
|
152
|
+
"CWE-520", "CWE-526", "CWE-537", "CWE-541", "CWE-547", "CWE-611", "CWE-614",
|
|
153
|
+
"CWE-756", "CWE-776", "CWE-942", "CWE-1004", "CWE-1032", "CWE-1174"],
|
|
154
|
+
risk_factors={
|
|
155
|
+
"threat_agents": "Attackers with system access",
|
|
156
|
+
"exploitability": "Easy",
|
|
157
|
+
"prevalence": "Widespread",
|
|
158
|
+
"detectability": "Easy",
|
|
159
|
+
"impact": "Moderate"
|
|
160
|
+
},
|
|
161
|
+
prevention=[
|
|
162
|
+
"A repeatable hardening process for fast and easy deployment",
|
|
163
|
+
"A minimal platform without unnecessary features and components",
|
|
164
|
+
"A task to review and update configurations as part of patch management",
|
|
165
|
+
"A segmented application architecture with effective separation",
|
|
166
|
+
"Sending security directives to clients, e.g., Security Headers"
|
|
167
|
+
]
|
|
168
|
+
),
|
|
169
|
+
|
|
170
|
+
"A06": OWASPCategory(
|
|
171
|
+
id="A06:2021",
|
|
172
|
+
name="Vulnerable and Outdated Components",
|
|
173
|
+
description="Components run with the same privileges as the application. "
|
|
174
|
+
"If a vulnerable component is exploited, such an attack can "
|
|
175
|
+
"facilitate serious data loss or server takeover.",
|
|
176
|
+
cwes=["CWE-937", "CWE-1035", "CWE-1104"],
|
|
177
|
+
risk_factors={
|
|
178
|
+
"threat_agents": "Attackers with vulnerability knowledge",
|
|
179
|
+
"exploitability": "Average",
|
|
180
|
+
"prevalence": "Widespread",
|
|
181
|
+
"detectability": "Difficult",
|
|
182
|
+
"impact": "Moderate to Severe"
|
|
183
|
+
},
|
|
184
|
+
prevention=[
|
|
185
|
+
"Remove unused dependencies, unnecessary features, components",
|
|
186
|
+
"Continuously inventory component versions (client and server-side)",
|
|
187
|
+
"Monitor sources like CVE and NVD for vulnerabilities",
|
|
188
|
+
"Only obtain components from official sources over secure links",
|
|
189
|
+
"Monitor for libraries and components that are unmaintained"
|
|
190
|
+
]
|
|
191
|
+
),
|
|
192
|
+
|
|
193
|
+
"A07": OWASPCategory(
|
|
194
|
+
id="A07:2021",
|
|
195
|
+
name="Identification and Authentication Failures",
|
|
196
|
+
description="Confirmation of the user's identity, authentication, and session "
|
|
197
|
+
"management is critical to protect against authentication-related attacks.",
|
|
198
|
+
cwes=["CWE-255", "CWE-259", "CWE-287", "CWE-288", "CWE-290", "CWE-294", "CWE-295",
|
|
199
|
+
"CWE-297", "CWE-300", "CWE-302", "CWE-304", "CWE-306", "CWE-307", "CWE-346",
|
|
200
|
+
"CWE-384", "CWE-521", "CWE-613", "CWE-620", "CWE-640", "CWE-798", "CWE-940",
|
|
201
|
+
"CWE-1216"],
|
|
202
|
+
risk_factors={
|
|
203
|
+
"threat_agents": "Anyone attempting to impersonate users",
|
|
204
|
+
"exploitability": "Average",
|
|
205
|
+
"prevalence": "Common",
|
|
206
|
+
"detectability": "Average",
|
|
207
|
+
"impact": "Severe"
|
|
208
|
+
},
|
|
209
|
+
prevention=[
|
|
210
|
+
"Implement multi-factor authentication",
|
|
211
|
+
"Do not ship or deploy with any default credentials",
|
|
212
|
+
"Implement weak-password checks against top 10,000 worst passwords",
|
|
213
|
+
"Use a server-side session manager that generates random session IDs",
|
|
214
|
+
"Limit or increasingly delay failed login attempts"
|
|
215
|
+
]
|
|
216
|
+
),
|
|
217
|
+
|
|
218
|
+
"A08": OWASPCategory(
|
|
219
|
+
id="A08:2021",
|
|
220
|
+
name="Software and Data Integrity Failures",
|
|
221
|
+
description="Code and infrastructure that does not protect against integrity "
|
|
222
|
+
"violations. This includes using plugins, libraries, or modules from "
|
|
223
|
+
"untrusted sources, repositories, and CDNs.",
|
|
224
|
+
cwes=["CWE-345", "CWE-353", "CWE-426", "CWE-494", "CWE-502", "CWE-565", "CWE-784",
|
|
225
|
+
"CWE-829", "CWE-830", "CWE-915"],
|
|
226
|
+
risk_factors={
|
|
227
|
+
"threat_agents": "Supply chain or CI/CD attackers",
|
|
228
|
+
"exploitability": "Average",
|
|
229
|
+
"prevalence": "Common",
|
|
230
|
+
"detectability": "Difficult",
|
|
231
|
+
"impact": "Severe"
|
|
232
|
+
},
|
|
233
|
+
prevention=[
|
|
234
|
+
"Use digital signatures to verify software or data is from expected source",
|
|
235
|
+
"Ensure libraries and dependencies are consuming trusted repositories",
|
|
236
|
+
"Use a software supply chain security tool like OWASP Dependency-Check",
|
|
237
|
+
"Ensure your CI/CD pipeline has proper segregation and access control",
|
|
238
|
+
"Do not send unsigned or unencrypted serialized data to untrusted clients"
|
|
239
|
+
]
|
|
240
|
+
),
|
|
241
|
+
|
|
242
|
+
"A09": OWASPCategory(
|
|
243
|
+
id="A09:2021",
|
|
244
|
+
name="Security Logging and Monitoring Failures",
|
|
245
|
+
description="This category helps detect, escalate, and respond to active breaches. "
|
|
246
|
+
"Without logging and monitoring, breaches cannot be detected.",
|
|
247
|
+
cwes=["CWE-117", "CWE-223", "CWE-532", "CWE-778"],
|
|
248
|
+
risk_factors={
|
|
249
|
+
"threat_agents": "Attackers relying on lack of monitoring",
|
|
250
|
+
"exploitability": "Average",
|
|
251
|
+
"prevalence": "Widespread",
|
|
252
|
+
"detectability": "Difficult",
|
|
253
|
+
"impact": "Moderate"
|
|
254
|
+
},
|
|
255
|
+
prevention=[
|
|
256
|
+
"Ensure all login, access control, and server-side input validation failures are logged",
|
|
257
|
+
"Ensure logs are generated in a format easily consumed by log management solutions",
|
|
258
|
+
"Ensure log data is encoded correctly to prevent injections",
|
|
259
|
+
"Establish effective monitoring and alerting",
|
|
260
|
+
"Establish an incident response and recovery plan"
|
|
261
|
+
]
|
|
262
|
+
),
|
|
263
|
+
|
|
264
|
+
"A10": OWASPCategory(
|
|
265
|
+
id="A10:2021",
|
|
266
|
+
name="Server-Side Request Forgery",
|
|
267
|
+
description="SSRF flaws occur whenever a web application is fetching a remote "
|
|
268
|
+
"resource without validating the user-supplied URL. It allows an "
|
|
269
|
+
"attacker to coerce the application to send a crafted request to "
|
|
270
|
+
"an unexpected destination.",
|
|
271
|
+
cwes=["CWE-918"],
|
|
272
|
+
risk_factors={
|
|
273
|
+
"threat_agents": "Attackers with access to URL input",
|
|
274
|
+
"exploitability": "Average",
|
|
275
|
+
"prevalence": "Common",
|
|
276
|
+
"detectability": "Average",
|
|
277
|
+
"impact": "Moderate to Severe"
|
|
278
|
+
},
|
|
279
|
+
prevention=[
|
|
280
|
+
"Sanitize and validate all client-supplied input data",
|
|
281
|
+
"Enforce the URL schema, port, and destination with a positive allow list",
|
|
282
|
+
"Do not send raw responses to clients",
|
|
283
|
+
"Disable HTTP redirections",
|
|
284
|
+
"Use network-level firewall policies to block all but essential traffic"
|
|
285
|
+
]
|
|
286
|
+
)
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
class OWASPMapper:
|
|
291
|
+
"""OWASP Top 10 specific mapper."""
|
|
292
|
+
|
|
293
|
+
def __init__(self):
|
|
294
|
+
self.categories = OWASP_TOP_10
|
|
295
|
+
|
|
296
|
+
def get_category(self, cwe_id: str) -> Optional[OWASPCategory]:
|
|
297
|
+
"""Get OWASP category for a CWE."""
|
|
298
|
+
cwe_id = cwe_id.upper()
|
|
299
|
+
if not cwe_id.startswith("CWE-"):
|
|
300
|
+
cwe_id = f"CWE-{cwe_id}"
|
|
301
|
+
|
|
302
|
+
for cat_id, category in self.categories.items():
|
|
303
|
+
if cwe_id in category.cwes:
|
|
304
|
+
return category
|
|
305
|
+
|
|
306
|
+
return None
|
|
307
|
+
|
|
308
|
+
def get_category_by_id(self, category_id: str) -> Optional[OWASPCategory]:
|
|
309
|
+
"""Get OWASP category by ID (A01-A10)."""
|
|
310
|
+
return self.categories.get(category_id.upper())
|
|
311
|
+
|
|
312
|
+
def get_all_cwes_for_category(self, category_id: str) -> List[str]:
|
|
313
|
+
"""Get all CWEs mapped to a category."""
|
|
314
|
+
category = self.categories.get(category_id.upper())
|
|
315
|
+
return category.cwes if category else []
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
def get_owasp_category(cwe_id: str) -> Optional[str]:
|
|
319
|
+
"""
|
|
320
|
+
Get OWASP category ID for a CWE.
|
|
321
|
+
|
|
322
|
+
Args:
|
|
323
|
+
cwe_id: CWE identifier
|
|
324
|
+
|
|
325
|
+
Returns:
|
|
326
|
+
OWASP category ID (A01-A10) or None
|
|
327
|
+
"""
|
|
328
|
+
mapper = OWASPMapper()
|
|
329
|
+
category = mapper.get_category(cwe_id)
|
|
330
|
+
return category.id if category else None
|