regscale-cli 6.20.10.0__py3-none-any.whl → 6.21.1.0__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.

Potentially problematic release.


This version of regscale-cli might be problematic. Click here for more details.

Files changed (64) hide show
  1. regscale/_version.py +1 -1
  2. regscale/core/app/application.py +12 -5
  3. regscale/core/app/internal/set_permissions.py +58 -27
  4. regscale/integrations/commercial/__init__.py +1 -2
  5. regscale/integrations/commercial/amazon/common.py +79 -2
  6. regscale/integrations/commercial/aws/cli.py +183 -9
  7. regscale/integrations/commercial/aws/scanner.py +544 -9
  8. regscale/integrations/commercial/cpe.py +18 -1
  9. regscale/integrations/commercial/nessus/scanner.py +2 -0
  10. regscale/integrations/commercial/sonarcloud.py +35 -36
  11. regscale/integrations/commercial/synqly/ticketing.py +51 -0
  12. regscale/integrations/commercial/tenablev2/jsonl_scanner.py +2 -1
  13. regscale/integrations/commercial/wizv2/async_client.py +10 -3
  14. regscale/integrations/commercial/wizv2/click.py +102 -26
  15. regscale/integrations/commercial/wizv2/constants.py +249 -1
  16. regscale/integrations/commercial/wizv2/issue.py +2 -2
  17. regscale/integrations/commercial/wizv2/parsers.py +3 -2
  18. regscale/integrations/commercial/wizv2/policy_compliance.py +1858 -0
  19. regscale/integrations/commercial/wizv2/scanner.py +15 -21
  20. regscale/integrations/commercial/wizv2/utils.py +258 -85
  21. regscale/integrations/commercial/wizv2/variables.py +4 -3
  22. regscale/integrations/compliance_integration.py +1455 -0
  23. regscale/integrations/integration_override.py +15 -6
  24. regscale/integrations/public/fedramp/fedramp_five.py +1 -1
  25. regscale/integrations/public/fedramp/markdown_parser.py +7 -1
  26. regscale/integrations/scanner_integration.py +193 -37
  27. regscale/models/app_models/__init__.py +1 -0
  28. regscale/models/integration_models/amazon_models/inspector_scan.py +32 -57
  29. regscale/models/integration_models/aqua.py +92 -78
  30. regscale/models/integration_models/cisa_kev_data.json +117 -5
  31. regscale/models/integration_models/defenderimport.py +64 -59
  32. regscale/models/integration_models/ecr_models/ecr.py +100 -147
  33. regscale/models/integration_models/flat_file_importer/__init__.py +52 -38
  34. regscale/models/integration_models/ibm.py +29 -47
  35. regscale/models/integration_models/nexpose.py +156 -68
  36. regscale/models/integration_models/prisma.py +46 -66
  37. regscale/models/integration_models/qualys.py +99 -93
  38. regscale/models/integration_models/snyk.py +229 -158
  39. regscale/models/integration_models/synqly_models/capabilities.json +1 -1
  40. regscale/models/integration_models/veracode.py +15 -20
  41. regscale/{integrations/commercial/wizv2/models.py → models/integration_models/wizv2.py} +4 -12
  42. regscale/models/integration_models/xray.py +276 -82
  43. regscale/models/regscale_models/control_implementation.py +14 -12
  44. regscale/models/regscale_models/file.py +4 -0
  45. regscale/models/regscale_models/issue.py +123 -0
  46. regscale/models/regscale_models/milestone.py +1 -1
  47. regscale/models/regscale_models/rbac.py +22 -0
  48. regscale/models/regscale_models/regscale_model.py +4 -2
  49. regscale/models/regscale_models/security_plan.py +1 -1
  50. regscale/utils/graphql_client.py +3 -1
  51. {regscale_cli-6.20.10.0.dist-info → regscale_cli-6.21.1.0.dist-info}/METADATA +9 -9
  52. {regscale_cli-6.20.10.0.dist-info → regscale_cli-6.21.1.0.dist-info}/RECORD +64 -60
  53. tests/fixtures/test_fixture.py +58 -2
  54. tests/regscale/core/test_app.py +5 -3
  55. tests/regscale/core/test_version_regscale.py +5 -3
  56. tests/regscale/integrations/test_integration_mapping.py +522 -40
  57. tests/regscale/integrations/test_issue_due_date.py +1 -1
  58. tests/regscale/integrations/test_update_finding_dates.py +336 -0
  59. tests/regscale/integrations/test_wiz_policy_compliance_affected_controls.py +154 -0
  60. tests/regscale/models/test_asset.py +406 -50
  61. {regscale_cli-6.20.10.0.dist-info → regscale_cli-6.21.1.0.dist-info}/LICENSE +0 -0
  62. {regscale_cli-6.20.10.0.dist-info → regscale_cli-6.21.1.0.dist-info}/WHEEL +0 -0
  63. {regscale_cli-6.20.10.0.dist-info → regscale_cli-6.21.1.0.dist-info}/entry_points.txt +0 -0
  64. {regscale_cli-6.20.10.0.dist-info → regscale_cli-6.21.1.0.dist-info}/top_level.txt +0 -0
@@ -3,7 +3,225 @@
3
3
  from enum import Enum
4
4
  from typing import List, Optional
5
5
 
6
- from regscale.models import IssueSeverity
6
+ from regscale.models import IssueSeverity, regscale_models
7
+
8
+ WIZ_POLICY_QUERY = """
9
+ query PolicyAssessmentsTable($filterBy: PolicyAssessmentFilters, $first: Int, $after: String) {
10
+ policyAssessments(filterBy: $filterBy, first: $first, after: $after) {
11
+ nodes {
12
+ id
13
+ policy {
14
+ ... on CloudConfigurationRule {
15
+ id
16
+ shortId
17
+ name
18
+ ruleDescription: description
19
+ severity
20
+ graphId
21
+ remediationInstructions
22
+ risks
23
+ threats
24
+ securitySubCategories {
25
+ ...SecuritySubCategoriesDetails
26
+ }
27
+ }
28
+ ... on Control {
29
+ id
30
+ name
31
+ description
32
+ lastRunAt
33
+ lastRunError
34
+ lastSuccessfulRunAt
35
+ severity
36
+ risks
37
+ threats
38
+ securitySubCategories {
39
+ ...SecuritySubCategoriesDetails
40
+ }
41
+ }
42
+ ... on HostConfigurationRule {
43
+ id
44
+ name
45
+ shortName
46
+ remediationInstructions
47
+ risks
48
+ threats
49
+ securitySubCategories {
50
+ ...SecuritySubCategoriesDetails
51
+ }
52
+ }
53
+ }
54
+ result
55
+ resource {
56
+ id
57
+ name
58
+ type
59
+ region
60
+ tags { key value }
61
+ subscription { id name externalId cloudProvider }
62
+ }
63
+ output {
64
+ ... on Issue { id issueStatus: status }
65
+ ... on ConfigurationFinding { id name cloudConfigurationFindingStatus: status remediation }
66
+ ... on HostConfigurationRuleAssessment { id hostConfigurationRule: rule { id name shortName description remediationInstructions } }
67
+ }
68
+ }
69
+ pageInfo { hasNextPage endCursor }
70
+ totalCount
71
+ }
72
+ }
73
+
74
+ fragment SecuritySubCategoriesDetails on SecuritySubCategory {
75
+ description
76
+ id
77
+ resolutionRecommendation
78
+ title
79
+ externalId
80
+ category { id name framework { id name enabled } }
81
+ }
82
+ """
83
+
84
+ WIZ_FRAMEWORK_QUERY = """
85
+ query SecurityFrameworksTable($first: Int, $after: String, $filterBy: SecurityFrameworkFilters) {
86
+ securityFrameworks(first: $first, after: $after, filterBy: $filterBy) {
87
+ nodes { policyTypes ...SecurityFrameworkFragment }
88
+ pageInfo { hasNextPage endCursor }
89
+ totalCount
90
+ }
91
+ }
92
+
93
+ fragment SecurityFrameworkFragment on SecurityFramework {
94
+ id
95
+ name
96
+ description
97
+ builtin
98
+ enabled
99
+ parentFramework { id name }
100
+ }
101
+ """
102
+
103
+ # Comprehensive framework mappings with shorthand names for easy CLI usage
104
+ FRAMEWORK_MAPPINGS = {
105
+ "wf-id-4": "NIST SP 800-53 Revision 5",
106
+ "wf-id-48": "NIST SP 800-53 Revision 4",
107
+ "wf-id-5": "FedRAMP (Moderate and Low levels)",
108
+ "wf-id-17": "CIS Controls v7.1",
109
+ "wf-id-24": "CIS Controls v8",
110
+ "wf-id-6": "CIS AWS v1.2.0",
111
+ "wf-id-7": "CIS AWS v1.3.0",
112
+ "wf-id-32": "CIS AWS v1.4.0",
113
+ "wf-id-45": "CIS AWS v1.5.0",
114
+ "wf-id-84": "CIS AWS v2.0.0",
115
+ "wf-id-98": "CIS AWS v3.0.0",
116
+ "wf-id-197": "CIS AWS v4.0.0",
117
+ "wf-id-50": "AWS Foundational Security Best Practices v1.0.0",
118
+ "wf-id-124": "AWS Well-Architected Framework (Section 2 - Security)",
119
+ "wf-id-8": "CIS Azure v1.3.0",
120
+ "wf-id-35": "CIS Azure v1.4.0",
121
+ "wf-id-52": "CIS Azure v1.5.0",
122
+ "wf-id-74": "CIS Azure v2.0.0",
123
+ "wf-id-100": "CIS Azure v2.1.0",
124
+ "wf-id-196": "CIS Azure v2.1.0 (Latest)",
125
+ "wf-id-40": "Azure Security Benchmark v3",
126
+ "wf-id-9": "CIS GCP v1.1.0",
127
+ "wf-id-36": "CIS GCP v1.2.0",
128
+ "wf-id-53": "CIS GCP v1.3.0",
129
+ "wf-id-85": "CIS GCP v2.0.0",
130
+ "wf-id-25": "CIS AKS v1.0.0",
131
+ "wf-id-68": "CIS AKS v1.2.0",
132
+ "wf-id-75": "CIS AKS v1.3.0",
133
+ "wf-id-93": "CIS AKS v1.4.0",
134
+ "wf-id-162": "CIS AKS v1.5.0",
135
+ "wf-id-218": "CIS AKS v1.6.0",
136
+ "wf-id-23": "CIS EKS v1.0.1",
137
+ "wf-id-67": "CIS EKS v1.1.0",
138
+ "wf-id-86": "CIS EKS v1.2.0",
139
+ "wf-id-18": "CIS Kubernetes v1.5.1",
140
+ "wf-id-66": "CIS Kubernetes v1.6.1",
141
+ "wf-id-87": "CIS Kubernetes v1.7.0",
142
+ "wf-id-76": "SOC 2 Type I",
143
+ "wf-id-16": "ISO/IEC 27001:2013",
144
+ "wf-id-19": "PCI DSS v3.2.1",
145
+ "wf-id-78": "PCI DSS v4.0",
146
+ "wf-id-79": "GDPR",
147
+ "wf-id-64": "CCPA/CPRA",
148
+ "wf-id-77": "CCF (The Adobe Common Controls Framework)",
149
+ "wf-id-70": "Canadian PBMM (ITSG-33)",
150
+ "wf-id-111": "C5 - Cloud Computing Compliance Criteria Catalogue",
151
+ "wf-id-161": "CAF (Cyber Assessment Framework by NCSC)",
152
+ "wf-id-90": "APRA CPG 234",
153
+ "wf-id-207": "CISA Security Requirements for EO 14117",
154
+ "wf-id-214": "5Rs - Wiz for Data Security",
155
+ "wf-id-225": "Wiz for Risk Assessment",
156
+ }
157
+
158
+ FRAMEWORK_SHORTCUTS = {
159
+ "nist": "wf-id-4",
160
+ "nist53r5": "wf-id-4",
161
+ "nist53r4": "wf-id-48",
162
+ "fedramp": "wf-id-5",
163
+ "cis": "wf-id-24",
164
+ "cisv8": "wf-id-24",
165
+ "cisv7": "wf-id-17",
166
+ "aws": "wf-id-197",
167
+ "azure": "wf-id-196",
168
+ "gcp": "wf-id-85",
169
+ "k8s": "wf-id-87",
170
+ "kubernetes": "wf-id-87",
171
+ "eks": "wf-id-86",
172
+ "aks": "wf-id-218",
173
+ "soc2": "wf-id-76",
174
+ "iso27001": "wf-id-16",
175
+ "pci": "wf-id-78",
176
+ "gdpr": "wf-id-79",
177
+ "ccpa": "wf-id-64",
178
+ "aws-foundational": "wf-id-50",
179
+ "aws-wellarchitected": "wf-id-124",
180
+ "azure-benchmark": "wf-id-40",
181
+ }
182
+
183
+ FRAMEWORK_CATEGORIES = {
184
+ "NIST Frameworks": ["wf-id-4", "wf-id-48", "wf-id-5"],
185
+ "CIS Controls": ["wf-id-17", "wf-id-24"],
186
+ "AWS Security": [
187
+ "wf-id-197",
188
+ "wf-id-50",
189
+ "wf-id-124",
190
+ "wf-id-6",
191
+ "wf-id-7",
192
+ "wf-id-32",
193
+ "wf-id-45",
194
+ "wf-id-84",
195
+ "wf-id-98",
196
+ ],
197
+ "Azure Security": [
198
+ "wf-id-196",
199
+ "wf-id-40",
200
+ "wf-id-8",
201
+ "wf-id-35",
202
+ "wf-id-52",
203
+ "wf-id-74",
204
+ "wf-id-100",
205
+ ],
206
+ "Google Cloud Security": ["wf-id-85", "wf-id-9", "wf-id-36", "wf-id-53"],
207
+ "Kubernetes Security": [
208
+ "wf-id-87",
209
+ "wf-id-86",
210
+ "wf-id-218",
211
+ "wf-id-18",
212
+ "wf-id-23",
213
+ "wf-id-25",
214
+ "wf-id-66",
215
+ "wf-id-67",
216
+ "wf-id-68",
217
+ "wf-id-75",
218
+ "wf-id-93",
219
+ "wf-id-162",
220
+ ],
221
+ "Industry Standards": ["wf-id-76", "wf-id-16", "wf-id-78", "wf-id-19"],
222
+ "Privacy & Data Protection": ["wf-id-79", "wf-id-64", "wf-id-214"],
223
+ "Government/Regulatory": ["wf-id-70", "wf-id-111", "wf-id-161", "wf-id-90", "wf-id-207"],
224
+ }
7
225
 
8
226
  SBOM_FILE_PATH = "artifacts/wiz_sbom.json"
9
227
  INVENTORY_FILE_PATH = "artifacts/wiz_inventory.json"
@@ -181,6 +399,36 @@ RECOMMENDED_WIZ_INVENTORY_TYPES = [
181
399
  "VIRTUAL_NETWORK",
182
400
  ]
183
401
 
402
+ # This is the set of technology deploymentModels and CloudResource types which we
403
+ # map to the asset category Hardware (instead of Software) when the useWizHardwareTypes
404
+ # feature is enabled.
405
+ # So either things which are hardware-like, or which use technologies that, in turn,
406
+ # imply they are hardware-like.
407
+ # Note that using technology deploymentModels can grab things such as virutal machine
408
+ # image files in addition to actual virtual machines. While this doesn't fit with
409
+ # general concepts of "hardware", for the purposes of attestation, it is the correct
410
+ # choice, as we may be certifying a source image that dynamic resources are created from,
411
+ # rather than attempt to document a variable pool of auto-scaled resources.
412
+ DEFAULT_WIZ_HARDWARE_TYPES = [
413
+ # CloudResource types
414
+ "VIRTUAL_MACHINE",
415
+ "VIRTUAL_MACHINE_IMAGE",
416
+ "CONTAINER",
417
+ "CONTAINER_IMAGE",
418
+ "DB_SERVER",
419
+ # technology deploymentModels
420
+ "SERVER_APPLICATION",
421
+ "CLIENT_APPLICATION",
422
+ "VIRTUAL_APPLIANCE",
423
+ ]
424
+
425
+ # This maps CPE part values to Asset categories.
426
+ CPE_PART_TO_CATEGORY_MAPPING = {
427
+ "h": regscale_models.AssetCategory.Hardware, # Hardware
428
+ "a": regscale_models.AssetCategory.Software, # Application
429
+ "o": regscale_models.AssetCategory.Software, # Other? Operating system? (includes OSs and firmware)
430
+ }
431
+
184
432
  INVENTORY_QUERY = """
185
433
  query CloudResourceSearch(
186
434
  $filterBy: CloudResourceFilters
@@ -262,12 +262,12 @@ class WizIssue(WizVulnerabilityIntegration):
262
262
  return "Wiz-Event"
263
263
  if not name:
264
264
  return f"Wiz-{service_type}-Event"
265
- event_match = re.match(r"^([A-Za-z\s]+?)\s+(?:detection|event|alert|activity)", name)
265
+ event_match = re.match(r"^([A-Za-z\s]+?)\s+(detection|event|alert|activity)", name)
266
266
  if not event_match:
267
267
  return f"Wiz-{service_type}-Event"
268
268
 
269
269
  event_type = event_match.group(1).strip()
270
- if event_type == "Suspicious activity":
270
+ if event_type == "Suspicious" and event_match.group(2).strip().lower() == "activity":
271
271
  return f"Wiz-{service_type}-SuspiciousActivity"
272
272
 
273
273
  event_type = "".join(word.capitalize() for word in event_type.split())
@@ -76,11 +76,12 @@ def get_software_name_from_cpe(wiz_entity_properties: Dict, name: str) -> Dict:
76
76
  """
77
77
  cpe_info_dict = {
78
78
  "name": name,
79
+ "part": None,
79
80
  "software_name": None,
80
81
  "software_version": None,
81
82
  "software_vendor": None,
82
83
  }
83
- if "cpe" in wiz_entity_properties.keys() and wiz_entity_properties.get("cpe"):
84
+ if "cpe" in wiz_entity_properties and wiz_entity_properties.get("cpe"):
84
85
  cpe_info_dict = extract_product_name_and_version(wiz_entity_properties.get("cpe", ""))
85
86
  cpe_info_dict["name"] = name
86
87
  return cpe_info_dict
@@ -349,7 +350,7 @@ def get_ip_address(
349
350
  ip6_address = None
350
351
  dns = None
351
352
  url = None
352
- if "address" in wiz_entity_properties.keys():
353
+ if "address" in wiz_entity_properties:
353
354
  if wiz_entity_properties.get("addressType") == "IPV4":
354
355
  ip4_address = wiz_entity_properties.get("address")
355
356
  elif wiz_entity_properties.get("addressType") == "IPV6":