regscale-cli 6.20.5.0__py3-none-any.whl → 6.20.6.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 (32) hide show
  1. regscale/__init__.py +1 -1
  2. regscale/_version.py +39 -0
  3. regscale/core/app/internal/__init__.py +13 -0
  4. regscale/core/app/internal/set_permissions.py +173 -0
  5. regscale/core/app/utils/file_utils.py +11 -1
  6. regscale/core/app/utils/regscale_utils.py +1 -133
  7. regscale/core/utils/date.py +62 -29
  8. regscale/integrations/commercial/wizv2/click.py +9 -5
  9. regscale/integrations/commercial/wizv2/constants.py +15 -0
  10. regscale/integrations/commercial/wizv2/parsers.py +23 -0
  11. regscale/integrations/commercial/wizv2/scanner.py +84 -29
  12. regscale/integrations/commercial/wizv2/utils.py +91 -4
  13. regscale/integrations/commercial/wizv2/variables.py +2 -1
  14. regscale/integrations/commercial/wizv2/wiz_auth.py +3 -3
  15. regscale/integrations/public/fedramp/fedramp_docx.py +2 -3
  16. regscale/integrations/scanner_integration.py +7 -2
  17. regscale/models/integration_models/cisa_kev_data.json +50 -5
  18. regscale/models/integration_models/synqly_models/capabilities.json +1 -1
  19. regscale/models/regscale_models/__init__.py +2 -0
  20. regscale/models/regscale_models/asset.py +1 -1
  21. regscale/models/regscale_models/modules.py +88 -1
  22. regscale/models/regscale_models/regscale_model.py +7 -1
  23. regscale/models/regscale_models/vulnerability.py +3 -3
  24. regscale/models/regscale_models/vulnerability_mapping.py +2 -2
  25. regscale/regscale.py +2 -0
  26. {regscale_cli-6.20.5.0.dist-info → regscale_cli-6.20.6.0.dist-info}/METADATA +1 -1
  27. {regscale_cli-6.20.5.0.dist-info → regscale_cli-6.20.6.0.dist-info}/RECORD +32 -29
  28. tests/regscale/test_init.py +94 -0
  29. {regscale_cli-6.20.5.0.dist-info → regscale_cli-6.20.6.0.dist-info}/LICENSE +0 -0
  30. {regscale_cli-6.20.5.0.dist-info → regscale_cli-6.20.6.0.dist-info}/WHEEL +0 -0
  31. {regscale_cli-6.20.5.0.dist-info → regscale_cli-6.20.6.0.dist-info}/entry_points.txt +0 -0
  32. {regscale_cli-6.20.5.0.dist-info → regscale_cli-6.20.6.0.dist-info}/top_level.txt +0 -0
@@ -1,10 +1,12 @@
1
1
  """RegScale models."""
2
2
 
3
+ from .assessment_plan import *
3
4
  from .assessment import *
4
5
  from .asset import *
5
6
  from .asset_mapping import *
6
7
  from .business_impact_assessment import *
7
8
  from .catalog import *
9
+ from .case import *
8
10
  from .cci import *
9
11
  from .change import *
10
12
  from .checklist import *
@@ -8,7 +8,7 @@ from enum import Enum
8
8
  from typing import Any, List, Optional, Union, cast
9
9
  from urllib.parse import urljoin
10
10
 
11
- from pydantic import ConfigDict, Field
11
+ from pydantic import Field
12
12
  from requests import Response
13
13
  from rich.progress import Progress
14
14
 
@@ -4,7 +4,7 @@
4
4
 
5
5
  # standard python imports
6
6
  from dataclasses import asdict, dataclass
7
- from typing import Any
7
+ from typing import Any, Optional
8
8
 
9
9
  from rich.console import Console
10
10
  from rich.table import Table
@@ -189,3 +189,90 @@ class Modules:
189
189
 
190
190
  # return the string
191
191
  return output
192
+
193
+ @staticmethod
194
+ def module_to_class(module: str) -> Optional[Any]:
195
+ """
196
+ Function to convert RegScale module to RegScale class
197
+
198
+ :param str module: RegScale module
199
+ :return: RegScale class if found in the mapping, else None
200
+ :rtype: Optional[Any]
201
+ """
202
+ from regscale.models import (
203
+ AssessmentPlan,
204
+ Assessment,
205
+ Asset,
206
+ Case,
207
+ Catalog,
208
+ Change,
209
+ Component,
210
+ Evidence,
211
+ Incident,
212
+ Issue,
213
+ Policy,
214
+ Project,
215
+ Questionnaires,
216
+ Requirement,
217
+ Risk,
218
+ SecurityPlan,
219
+ SupplyChain,
220
+ Task,
221
+ Threat,
222
+ )
223
+
224
+ regscale_models = {
225
+ "assessmentplans": AssessmentPlan,
226
+ "assessments": Assessment,
227
+ "assets": Asset,
228
+ "cases": Case,
229
+ "catalogues": Catalog,
230
+ "changes": Change,
231
+ "components": Component,
232
+ "evidence": Evidence,
233
+ "incidents": Incident,
234
+ "issues": Issue,
235
+ "policies": Policy,
236
+ "projects": Project,
237
+ "questionnaires": Questionnaires,
238
+ "requirements": Requirement,
239
+ "risks": Risk,
240
+ "securityplans": SecurityPlan,
241
+ "supplychain": SupplyChain,
242
+ "tasks": Task,
243
+ "threats": Threat,
244
+ }
245
+
246
+ return regscale_models.get(module) or None
247
+
248
+ @staticmethod
249
+ def get_module_to_id(module: str) -> Optional[int]:
250
+ """
251
+ Returns the id of a RegScale module
252
+
253
+ :return: id of RegScale module, if found in the mapping, else None
254
+ :rtype: Optional[int]
255
+ """
256
+ module_to_id = {
257
+ "assessmentplans": 33,
258
+ "assessments": 2,
259
+ "assets": 3,
260
+ "cases": 28,
261
+ "catalogues": 4,
262
+ "changes": 31,
263
+ "components": 27,
264
+ "evidence": 32,
265
+ "incidents": 8,
266
+ "issues": 10,
267
+ "policies": 11,
268
+ "projects": 12,
269
+ "questionnaires": 26,
270
+ "requirements": 13,
271
+ "risks": 14,
272
+ "securityplans": 16,
273
+ "supplychain": 25,
274
+ "tasks": 18,
275
+ "threats": 19,
276
+ }
277
+
278
+ return module_to_id.get(module)
@@ -1150,13 +1150,18 @@ class RegScaleModel(BaseModel, ABC):
1150
1150
  :return: The saved object
1151
1151
  :rtype: T
1152
1152
  """
1153
- if self.has_changed():
1153
+ # Check if the model has change tracking and if there are changes
1154
+ has_change_tracking = hasattr(self, "has_changed") and callable(getattr(self, "has_changed", None))
1155
+ should_save = not has_change_tracking or self.has_changed()
1156
+
1157
+ if should_save:
1154
1158
  if bulk:
1155
1159
  logger.debug(f"Adding {self.__class__.__name__} {self.id} to pending updates")
1156
1160
  self._get_pending_updates().add(self._get_cache_key(self))
1157
1161
  self.cache_object(self) # Update the cache with the current state
1158
1162
  return self
1159
1163
  else:
1164
+ logger.debug(f"Saving {self.__class__.__name__} {self.id}")
1160
1165
  return self._perform_save()
1161
1166
  else:
1162
1167
  logger.debug(f"No changes detected for {self.__class__.__name__} {self.id}")
@@ -1284,6 +1289,7 @@ class RegScaleModel(BaseModel, ABC):
1284
1289
  endpoint = self.get_endpoint("update").format(id=self.id)
1285
1290
  response = self._get_api_handler().put(endpoint=endpoint, data=self.dict(), headers=self._get_headers())
1286
1291
  if hasattr(response, "ok") and response.ok:
1292
+ logger.debug(f"Successfully saved {self.__class__.__name__} {self.id}")
1287
1293
  obj = self.__class__(**response.json())
1288
1294
  self.cache_object(obj)
1289
1295
  return obj
@@ -14,9 +14,9 @@ from regscale.core.app.api import Api
14
14
  from regscale.core.app.application import Application
15
15
  from regscale.core.app.utils.app_utils import get_current_datetime
16
16
  from regscale.models import regscale_models
17
+ from regscale.models.regscale_models.issue import IssueStatus
17
18
  from regscale.models.regscale_models.regscale_model import RegScaleModel
18
19
 
19
-
20
20
  logger = logging.getLogger("regscale")
21
21
 
22
22
 
@@ -68,7 +68,7 @@ class Vulnerability(RegScaleModel):
68
68
  firstSeen: Optional[str] = None
69
69
  daysOpen: Optional[int] = None
70
70
  dns: Optional[str] = None
71
- ipAddress: Optional[str] = ""
71
+ ipAddress: Optional[str] = None
72
72
  mitigated: Optional[bool] = None
73
73
  operatingSystem: Optional[str] = None
74
74
  port: Optional[Union[str, int]] = None
@@ -86,7 +86,7 @@ class Vulnerability(RegScaleModel):
86
86
  tenantsId: int = Field(default=0)
87
87
  isPublic: bool = Field(default=False)
88
88
  dateClosed: Optional[str] = None
89
- status: Optional[VulnerabilityStatus] = VulnerabilityStatus.Open
89
+ status: Optional[Union[str, IssueStatus]] = Field(default_factory=IssueStatus.Open)
90
90
  buildVersion: Optional[str] = None
91
91
  cvsSv3BaseVector: Optional[str] = None
92
92
  cvsSv2BaseVector: Optional[str] = None
@@ -23,7 +23,7 @@ class VulnerabilityMapping(RegScaleModel):
23
23
  vulnerabilityId: int
24
24
  assetId: int
25
25
  scanId: Optional[int] = None
26
- securityPlansId: Optional[int] = None
26
+ securityPlanId: Optional[int] = None
27
27
  status: Optional[str] = Field(max_length=450)
28
28
  firstSeen: str
29
29
  lastSeen: str
@@ -33,7 +33,7 @@ class VulnerabilityMapping(RegScaleModel):
33
33
  lastUpdatedById: str = Field(default_factory=RegScaleModel.get_user_id)
34
34
  dateCreated: str
35
35
  dateLastUpdated: Optional[str] = None
36
- tenantsId: int = Field(default=0)
36
+ tenantsId: int = Field(default=1)
37
37
 
38
38
  @staticmethod
39
39
  def _get_additional_endpoints() -> ConfigDict:
regscale/regscale.py CHANGED
@@ -127,6 +127,7 @@ file_upload = import_command_with_timing("regscale.core.app.internal.file_upload
127
127
  migrations = import_command_with_timing(INTERNAL, "migrations")
128
128
  model = import_command_with_timing(INTERNAL, "model")
129
129
  issues = import_command_with_timing(INTERNAL, "issues")
130
+ set_permissions = import_command_with_timing(INTERNAL, "set_permissions")
130
131
 
131
132
  ############################################################
132
133
  # Public Integrations
@@ -757,6 +758,7 @@ cli.add_command(evidence) # add Evidence Feature
757
758
  cli.add_command(migrations) # add data migration support
758
759
  cli.add_command(issues) # add POAM(Issues) Editor Feature
759
760
  cli.add_command(model) # add POAM(Issues) Editor Feature
761
+ cli.add_command(set_permissions) # add builk editor for record permissions
760
762
 
761
763
  ############################################################
762
764
  # Add Commercial Integrations
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: regscale-cli
3
- Version: 6.20.5.0
3
+ Version: 6.20.6.0
4
4
  Summary: Command Line Interface (CLI) for bulk processing/loading data into RegScale
5
5
  Home-page: https://github.com/RegScale/regscale-cli
6
6
  Author: Travis Howerton
@@ -1,5 +1,6 @@
1
- regscale/__init__.py,sha256=NG2YqNT-SOqEul9gYB4T2_-wp5yQlbqTCwORHAiQc9E,25
2
- regscale/regscale.py,sha256=2mNIkLGtQjIvl0m255iV20_3DK4oRSTlXYxe-8XQpeo,30764
1
+ regscale/__init__.py,sha256=ZygAIkX6Nbjag1czWdQa-yP-GM1mBE_9ss21Xh__JFc,34
2
+ regscale/_version.py,sha256=x6wIid4ymuFQH9uE0D5dtIycsH6xYzb1mpib16IO1ps,1198
3
+ regscale/regscale.py,sha256=xcxnTwEwWgfO3Fnp0LVo32SZCJzAswq3WDZgm21nHnI,30914
3
4
  regscale/airflow/__init__.py,sha256=yMwN0Bz4JbM0nl5qY_hPegxo_O2ilhTOL9PY5Njhn-s,270
4
5
  regscale/airflow/click_dags.py,sha256=H3SUR5jkvInNMv1gu-VG-Ja_H-kH145CpQYNalWNAbE,4520
5
6
  regscale/airflow/click_mixins.py,sha256=BTwKWsEu6KVtlrzFbXpD_RuEpMzc-CSnCCySUzqzCgQ,3571
@@ -37,7 +38,7 @@ regscale/core/app/__init__.py,sha256=nGcCN1vWBAnZzoccIlt0jwWQdegCOrBWOB7LPhQkQSs
37
38
  regscale/core/app/api.py,sha256=_hwh1HWIIrPfL4jHDKlEmW5pQEr2Iq3idn4bYGtfPQo,23148
38
39
  regscale/core/app/application.py,sha256=TalC51f30Ox6o7LBsh2RcCdU_YqFuCbGw1zhK2vSS7s,25982
39
40
  regscale/core/app/logz.py,sha256=8AdBKmquv45JGi5fCMc38JqQg6-FpUONGmqfd5EGwrI,2583
40
- regscale/core/app/internal/__init__.py,sha256=2ZJGwSuQBoQa1euFJ2pQsyEBMqWqXv7qq8yu02eQcYQ,4436
41
+ regscale/core/app/internal/__init__.py,sha256=rod4nmE7rrYDdbuYF4mCWz49TK_2r-v4tWy1UHW63r0,4808
41
42
  regscale/core/app/internal/admin_actions.py,sha256=hOdma7QGwFblmxEj9UTjiWWmZGUS5_ZFtxL2qZdhf-Q,7443
42
43
  regscale/core/app/internal/assessments_editor.py,sha256=UozEaQR1v3eXbkFgOY11CkjMLEAF27ej5vlMQ4O9XVA,31477
43
44
  regscale/core/app/internal/catalog.py,sha256=svBAgFZaGrkNHh2gZEo1ex2vdjllAIc4940soGykHOc,11088
@@ -51,15 +52,16 @@ regscale/core/app/internal/login.py,sha256=GsFaBwmSc32liWoRnMFy78m8SuB9pfUV0c1ly
51
52
  regscale/core/app/internal/migrations.py,sha256=wHIzb1uglLVOXawnb-K3Yt70Z5QyfQYb8ZZOMDrNRU4,7983
52
53
  regscale/core/app/internal/model_editor.py,sha256=0sxfg92TJYyECU9KwgHooXeY3ZdaF2i5gGWe1gButFY,61696
53
54
  regscale/core/app/internal/poam_editor.py,sha256=3PtpSMpV7bqKFuTHD2ACYcTyB3EEtTRKuYv-XArjd0A,22929
55
+ regscale/core/app/internal/set_permissions.py,sha256=MbUxe-zaAz5hK3BZ4IeY7Xbr8-FZOuJwkCbs_yVBC-k,5666
54
56
  regscale/core/app/internal/workflow.py,sha256=SpgYk1QyzdilVLOK1fFzaKhdLspumaugf5VezgboxhQ,4007
55
57
  regscale/core/app/utils/XMLIR.py,sha256=M_RrCsbjznihatkucCKw6dPgHTPQczXyqIdUXWhuCLI,8328
56
58
  regscale/core/app/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
57
59
  regscale/core/app/utils/api_handler.py,sha256=T1meKw6Yi3ZAgRbQ1xuKDVh9Q9B8mbMqqN_LrSwIlAM,11765
58
60
  regscale/core/app/utils/app_utils.py,sha256=zLEHHHWR4likFQYY_bZsWLTAoRajyyaWrESkotVrFlM,36240
59
- regscale/core/app/utils/file_utils.py,sha256=URKWVEiR9aFnwoW3-Io7R22tBVeROTC3sX1wOZuhqXw,8912
61
+ regscale/core/app/utils/file_utils.py,sha256=x7cqYPxJ-PgSb2lX_K6zhdqyGQjOCmr04lnqdBQV3hI,9269
60
62
  regscale/core/app/utils/parser_utils.py,sha256=aBEgcFwbJMD-ARf3wzf-tyWwR6NHvzEcdYcPMm8hGqo,2533
61
63
  regscale/core/app/utils/pickle_file_handler.py,sha256=iMdv4N8z00TB5LyPdxIcLKNRpDQVWQ8ZQWAqCKpqmF0,1695
62
- regscale/core/app/utils/regscale_utils.py,sha256=krtwcA6ohhF0iPDz3dMbzYv-nAqe-N5ENp2SZrg-JpY,11583
64
+ regscale/core/app/utils/regscale_utils.py,sha256=KuXTAfEO10DQTnhQadIBIQ02iuLD0D0xKUzf5Yv8yP4,7400
63
65
  regscale/core/app/utils/report_utils.py,sha256=rKn3nmiSPq8LTKM16UiKBSizTsZKh-7JwdOlfX6YSpQ,4210
64
66
  regscale/core/app/utils/variables.py,sha256=h29Qrr6jg-Feo74IeqHz28wYLhgtzZ2pCDMf6g0WJFU,8989
65
67
  regscale/core/app/utils/catalog_utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -92,7 +94,7 @@ regscale/core/static/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hS
92
94
  regscale/core/static/regex.py,sha256=KLg-do2oPuUD6bQG9usqqSy5sxqlSEAEuUUbGVkZ6eU,384
93
95
  regscale/core/utils/__init__.py,sha256=Eyvc210t-KRqvTcV5DNWRjKO99CdWy_dC57wfggFWcw,3876
94
96
  regscale/core/utils/click_utils.py,sha256=y6vAbaPoT0Abb8siS1tvJxJQTm4sbWQTeq5nTDIgBtI,375
95
- regscale/core/utils/date.py,sha256=C5J4xwiYihzWmlZYlSPeOFiEDOo94CFU-OOSGYqY6rs,9308
97
+ regscale/core/utils/date.py,sha256=_45gTGY0NrnnC49ajuYLGU8QLcTUKYm09C_z93O1oKs,10005
96
98
  regscale/core/utils/graphql.py,sha256=oXGBcAuDa0uasMnD4CokIzzKKa-IgExdKXLwtaK2_tA,8386
97
99
  regscale/core/utils/urls.py,sha256=ZcU9OJqDmVQXgu6BrLESIp2KMkkUuzTZZ_wHsZMzfA4,687
98
100
  regscale/dev/__init__.py,sha256=wVP59B1iurp36ul8pD_CjmunJLHOdKWWodz1r5loNvw,190
@@ -111,7 +113,7 @@ regscale/integrations/api_paginator.py,sha256=73rjaNM9mGv8evHAeoObXEjZPg-bJuGPo6
111
113
  regscale/integrations/api_paginator_example.py,sha256=lEuYI-xEGcjnXuIzbCobCP0YRuukLF0s8S3d382SAH4,12119
112
114
  regscale/integrations/integration_override.py,sha256=PH7t_bf-RCe_it3FJ61tlKX5UghqHuSEQNJWDfCamAg,5480
113
115
  regscale/integrations/jsonl_scanner_integration.py,sha256=l8nq_T3rE1XX-6HxrNHm3xzxCNWbIjxQvGMdtZWs7KQ,57003
114
- regscale/integrations/scanner_integration.py,sha256=PMP-BjSLDvBvdbc2z13zb5w3-HWfv0O41SSyj3TrLQE,135563
116
+ regscale/integrations/scanner_integration.py,sha256=lijwTk_VD_mhNN04lMgf_Wh3IKhv_INWESFgtjt_f8Q,135805
115
117
  regscale/integrations/variables.py,sha256=AyaG286U-ek2uQ4qeYBAG3eh_QnlBlth1PKZI5Je5sc,2212
116
118
  regscale/integrations/commercial/__init__.py,sha256=sVbzBnLbKRhnAmRsIw8kRvfbyJojPfVqzH3OlgoxvqM,13927
117
119
  regscale/integrations/commercial/ad.py,sha256=YXSmK8vRf6yi2GnREGa5GrE6GelhFrLj44SY8AO1pK0,15509
@@ -226,16 +228,16 @@ regscale/integrations/commercial/trivy/commands.py,sha256=YGQFtpQGkmcLT3X2OVp7lt
226
228
  regscale/integrations/commercial/trivy/scanner.py,sha256=iiwTvjqRlLRgQvCs_FP0j83B7ApOta0MSXyO0-iHfSk,11309
227
229
  regscale/integrations/commercial/wizv2/WizDataMixin.py,sha256=s7F_rVrP9IZa_x_vh3MswR7W_UBHRfd4kHGVsNX4ips,3606
228
230
  regscale/integrations/commercial/wizv2/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
229
- regscale/integrations/commercial/wizv2/click.py,sha256=hpexL0xHIW5WBUJu-hWQHI2vK9s6i1TI2mD6YWZOafs,12217
230
- regscale/integrations/commercial/wizv2/constants.py,sha256=xpcO8W9645MncNKbRFspD7m05fVhPK0dzwzToAm0ReQ,23141
231
+ regscale/integrations/commercial/wizv2/click.py,sha256=DPis8cMST7zVXMzajYUGqI5WNg6nh08afiQhExm54_c,12276
232
+ regscale/integrations/commercial/wizv2/constants.py,sha256=YamxNum-GHZgkTiCsKD_rii7B9chlFOeVR56FBKvZ80,23418
231
233
  regscale/integrations/commercial/wizv2/issue.py,sha256=qj5_g-SoOz6f5QDgs34GdQEyxFwJLKAWl1EVx7vjrAw,13407
232
234
  regscale/integrations/commercial/wizv2/models.py,sha256=hZ6557LJfcp1_NRbMM0V_G1erz1jEFmsuKPn86kXE54,5667
233
- regscale/integrations/commercial/wizv2/parsers.py,sha256=YcFOGdYZZ17hj2pcRMC9Ho2wPY94dfJ4hHwqTR5BB6c,11095
235
+ regscale/integrations/commercial/wizv2/parsers.py,sha256=BD0i-80NhfQAHYPk0EAbUClXfzxLT3aHzb2Gs2ObVAk,11811
234
236
  regscale/integrations/commercial/wizv2/sbom.py,sha256=QcGaYiBGtZ3mBcbo-KGl-I2u6QHKAIinTk26LPy0Kng,4466
235
- regscale/integrations/commercial/wizv2/scanner.py,sha256=ndUQxQ-_STzLTEtqSkVBsQYLMuFu0cxc1KYIxjUv9IA,21180
236
- regscale/integrations/commercial/wizv2/utils.py,sha256=Na0HRlymccXPzC1lybEPqHVuvCTbfw7r4LDi98_4mUg,34252
237
- regscale/integrations/commercial/wizv2/variables.py,sha256=W_m_TSLUDaqyKJZHukp6i8nftFuhQKb4WRVu9lIyMAs,2485
238
- regscale/integrations/commercial/wizv2/wiz_auth.py,sha256=BpQTYJn3u0QiWC2IAw-bunZpBPsJtDJgOsC2zOL_UU4,5554
237
+ regscale/integrations/commercial/wizv2/scanner.py,sha256=N-YVSbQJvTrg-tmxnxY_w7gJ7qS4VyBTuOiMMy3TXCo,23876
238
+ regscale/integrations/commercial/wizv2/utils.py,sha256=ELJZ9sgi2h9lEHFF7mlOQQ5f8MugM-sH72BZSRjF_nk,37550
239
+ regscale/integrations/commercial/wizv2/variables.py,sha256=TxyhBGgKUC1bpg-2gCNiU2txqDGiQosbguAFLecP69E,2591
240
+ regscale/integrations/commercial/wizv2/wiz_auth.py,sha256=qGcUhpC9eRkJIngmv3i9yHdp0q9rv6AvA5gHkypYzCE,5549
239
241
  regscale/integrations/integration/__init__.py,sha256=WJgPLnEahD94QLE8NR8QCzlf8xk2ix76_WPDlf98ezU,70
240
242
  regscale/integrations/integration/integration.py,sha256=pr_fbqBieYbqp3PdBjuqKuZCYFf0kF4GkFdlViTKG54,586
241
243
  regscale/integrations/integration/inventory.py,sha256=gHL1a6VSV3zf4DTmksEy8qXNrqhIun8TwLxhRpuEMqY,341
@@ -255,7 +257,7 @@ regscale/integrations/public/fedramp/components.py,sha256=z6PMObm-kjRR42bT04Efnj
255
257
  regscale/integrations/public/fedramp/docx_parser.py,sha256=EA9g1iTlB6-GtOzV9JwGW8x_SruhbaIMOzstCBvjiq8,10526
256
258
  regscale/integrations/public/fedramp/fedramp_cis_crm.py,sha256=IVASI6W0uEOg_SyxJSqyHev1KzSwEnF1RTWYT3qfViw,64576
257
259
  regscale/integrations/public/fedramp/fedramp_common.py,sha256=Mdy3_WdCEcTwSXEEKXiODmr2YJTWcTg6jfyWZJWfruQ,115406
258
- regscale/integrations/public/fedramp/fedramp_docx.py,sha256=GnRjuWEgE9XSe9egPOQSZ8lMjY4CpqcD2IS5paI-xQc,13742
260
+ regscale/integrations/public/fedramp/fedramp_docx.py,sha256=eKkRwfcIi4aHJp4ajKDUGJECItwrZwYfCiKzmfB2W1Q,13703
259
261
  regscale/integrations/public/fedramp/fedramp_five.py,sha256=F4KIOdnYaRjJrJHJYsN9Bmf6i5s0nus-t_GaAh8A3ow,92645
260
262
  regscale/integrations/public/fedramp/fedramp_traversal.py,sha256=BkgwsFluZO5g0Rc0WujYgbc1_YLofamJzFP7Z5UYfao,4528
261
263
  regscale/integrations/public/fedramp/import_fedramp_r4_ssp.py,sha256=Opld0vEZ4b71cIDogu6ykTUL86tXZVTSnwQzjz8w_4U,9925
@@ -309,7 +311,7 @@ regscale/models/integration_models/azure_alerts.py,sha256=2etrpvcxa7jVQrc98bJlVG
309
311
  regscale/models/integration_models/base64.py,sha256=sxV6O5qY1_TstJENX5jBPsSdQwmA83-NNhgJFunXiZE,570
310
312
  regscale/models/integration_models/burp.py,sha256=FBEBkH3U0Q8vq71FFoWnvgLRF5Hkr9GYmQFmNNHFrVk,16932
311
313
  regscale/models/integration_models/burp_models.py,sha256=UytDTAcCaxyu-knFkm_mEUH6UmWK3OTXKSC9Sc6OjVs,3669
312
- regscale/models/integration_models/cisa_kev_data.json,sha256=UNYylFQOW9KHp5YTozdUTC8NTNe-2xcNf6manT8MGF0,1228128
314
+ regscale/models/integration_models/cisa_kev_data.json,sha256=0-CT_plLwQFlIsFgJ-RZxQIi_uCeyIsrWiB2XNwXctA,1231803
313
315
  regscale/models/integration_models/defender_data.py,sha256=jsAcjKxiGmumGerj7xSWkFd6r__YpuKDnYX5o7xHDiE,2844
314
316
  regscale/models/integration_models/defenderimport.py,sha256=OFwEH0Xu-HFLIZJZ8hP60Ov3lS8RR7KHEsw4wI8QnoE,5766
315
317
  regscale/models/integration_models/drf.py,sha256=Aq7AdLa_CH97NrnR-CxaFI22JjVN9uCxVN7Z-BBUaNU,18896
@@ -339,7 +341,7 @@ regscale/models/integration_models/flat_file_importer/__init__.py,sha256=V_P3R0j
339
341
  regscale/models/integration_models/sbom/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
340
342
  regscale/models/integration_models/sbom/cyclone_dx.py,sha256=0pFR0BWBrF5c8_cC_8mj2MXvNOMHOdHbBYXvTVfFAh8,4058
341
343
  regscale/models/integration_models/synqly_models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
342
- regscale/models/integration_models/synqly_models/capabilities.json,sha256=A5IBt8dDS4g8Kztgos9xugSyvuvuE5YZZE8wfnRkZnU,349623
344
+ regscale/models/integration_models/synqly_models/capabilities.json,sha256=zGoXgG919b6Gh63Mdd6md4Js4z9c088z7UdAcQvyqXM,351522
343
345
  regscale/models/integration_models/synqly_models/connector_types.py,sha256=8nxptkTexpskySnmL0obNAff_iu_fx6tJ7i1-4hJvao,461
344
346
  regscale/models/integration_models/synqly_models/ocsf_mapper.py,sha256=e2kTOhWSNRnzbgMchMx-7c21pCgSv2DqWnxvajKEKJM,16960
345
347
  regscale/models/integration_models/synqly_models/param.py,sha256=Xt5Zm6lC_VkLj7LF2qXo72TJZHysqttsp5ai0NCf1po,2643
@@ -353,11 +355,11 @@ regscale/models/integration_models/synqly_models/connectors/vulnerabilities.py,s
353
355
  regscale/models/integration_models/tenable_models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
354
356
  regscale/models/integration_models/tenable_models/integration.py,sha256=lplL8zmjTFuhLreW-4y7G1fiCOBgzNAaATq800jgTQc,10271
355
357
  regscale/models/integration_models/tenable_models/models.py,sha256=dmG7btkN4YkDWwnfW5Ldc3tWEAGjPiaRgJjrqMOkPEU,15846
356
- regscale/models/regscale_models/__init__.py,sha256=f3i0UQgyaWxWxyQrNrIaV55KOEhMSGWZ6b_6OO7VngQ,2141
358
+ regscale/models/regscale_models/__init__.py,sha256=ejw7TPJPwS3BwF01-JzL6-R5DLO1zR7DVW9HHcMNCJ8,2192
357
359
  regscale/models/regscale_models/assessment.py,sha256=ekzNlcsfDGBu97PMCi7hBRGbzVgxk7Ij0RfrdGh1Rfw,20440
358
360
  regscale/models/regscale_models/assessment_plan.py,sha256=qo2YA5ckSbUKDHnC_2BUc2I9kMTje9Gq-qTCXqvEKCY,1716
359
361
  regscale/models/regscale_models/assessment_result.py,sha256=K48yjYKwgY1-d_Y3aQUDcCvaqcTIVYdbKV5Wgicf4Ts,1283
360
- regscale/models/regscale_models/asset.py,sha256=-ws6o6hRl2sMLNcT8CIw0SQvOwLtrVSeEp5kF80ydAQ,19840
362
+ regscale/models/regscale_models/asset.py,sha256=MDYIFlPfngjjr6obP0wLlQPFzNw8CIFeYVAKFnpdqR4,19828
361
363
  regscale/models/regscale_models/asset_mapping.py,sha256=HFlkAoPZHy2xPYq28cXuzLpFoP36SI08HTL8mH_Q-uE,6851
362
364
  regscale/models/regscale_models/business_impact_assessment.py,sha256=tkuvw1ssdrVJJcsHT43nFjFhAFTSSFRNfWRIg5W-d2k,2214
363
365
  regscale/models/regscale_models/case.py,sha256=hLVTwZXzusnXR9avqh7xSVLJwPJ1rPI_Nla_VAkpZcg,1192
@@ -402,7 +404,7 @@ regscale/models/regscale_models/link.py,sha256=lAY4Ig3Menm1EqfcAbVJ7jsCsRO5tWtJI
402
404
  regscale/models/regscale_models/master_assessment.py,sha256=t03-8vQJ7hnPNgEU0GSC1XGKOgAqHKuIupbt5IjJvtI,7322
403
405
  regscale/models/regscale_models/meta_data.py,sha256=Fg8rrWSTx3K00QkF4glH9UdY9OFWJ4_UqxleLSSbx8I,2482
404
406
  regscale/models/regscale_models/module.py,sha256=a7lalHmVTQ04ZILnJxuFWdHYDtyusBMTtonD4ICL-Wc,7272
405
- regscale/models/regscale_models/modules.py,sha256=CkR03zJhrBjhw50d-Kpyem7Ryh-QWz_RLHEMlx2e8VA,6150
407
+ regscale/models/regscale_models/modules.py,sha256=yeva_tct88o2NFt93_zmqUcXZ3LucVbAv5FvQPru3cQ,8551
406
408
  regscale/models/regscale_models/objective.py,sha256=aJIpmkZ-NscqV2y8SGB4HYzm615b6mklyHnW9bL2ljk,249
407
409
  regscale/models/regscale_models/organization.py,sha256=E3Y5bwtgaIRL4rbKxU3DyfFVYUzP3d-1umG_CIUG3gE,714
408
410
  regscale/models/regscale_models/parameter.py,sha256=WS5onxkvz119brxugoBidK7K_3CeNVzchLTvW8aEdJs,3859
@@ -419,7 +421,7 @@ regscale/models/regscale_models/questionnaire.py,sha256=QMSXfNpSoaS8tkeo80C7OWLj
419
421
  regscale/models/regscale_models/questionnaire_instance.py,sha256=1LgGTwFACmWx2xOOqUKhAUOms4_3L6NZySzuteg0_sI,8241
420
422
  regscale/models/regscale_models/rbac.py,sha256=oHzKqwL4bkH2XT4WaslbNlMnWayrSKP9zYbG72e2ijk,4522
421
423
  regscale/models/regscale_models/reference.py,sha256=P_7jT6H-NZIa7TyH3j98N-ZHlB6FsjpZVRZCCpms-D4,3253
422
- regscale/models/regscale_models/regscale_model.py,sha256=z-SbjQpwE67sM9pfDg2oiyIJSBEGIEwqfFvCAhzM3bA,68806
424
+ regscale/models/regscale_models/regscale_model.py,sha256=-TLI7FX63s0qHHERES33c7ho9_qHKb3X7-3dihFBd9E,69210
423
425
  regscale/models/regscale_models/requirement.py,sha256=-8PnMbuWAZHol5X1w-fzm-moD784Et0oevSVbz6xLhU,767
424
426
  regscale/models/regscale_models/risk.py,sha256=lZFDYPpTt0aEYCrYz5FBKk1Y4y2CKXYU1A8eEKT3zzg,8661
425
427
  regscale/models/regscale_models/risk_issue_mapping.py,sha256=j6uR0x6xymJ0BsIwgnadeUQDshHNhU3VnpyItZp4dc4,2393
@@ -441,8 +443,8 @@ regscale/models/regscale_models/task.py,sha256=le3N2GIUCEJrFnNh0DLU7RAcle4ULr8OP
441
443
  regscale/models/regscale_models/threat.py,sha256=4TNZcRnTgmlDwBsYu5Pbh9GRd8ZWAtqqr0Xph3uPNAA,7255
442
444
  regscale/models/regscale_models/user.py,sha256=wiU2qKwp3aYtmaHEmTtv8BbMEgFb913dHgc2VnmsAkg,7186
443
445
  regscale/models/regscale_models/user_group.py,sha256=vzlXHvPNsgJd38H0R3osi46Oj19QO5oPx0qXntQBKWI,1891
444
- regscale/models/regscale_models/vulnerability.py,sha256=VKgWMVvAQ74Sq46myYsivGfIeW63dHq3bv3cRCkDcbg,10960
445
- regscale/models/regscale_models/vulnerability_mapping.py,sha256=cq44xkkCH7rfp0BJxavr4DLiEAHouyyPmi5EaizH6NI,6261
446
+ regscale/models/regscale_models/vulnerability.py,sha256=klN8MYatevFGVaulex6WeLw-uvxT07ty-cXU9CxS_-Q,11042
447
+ regscale/models/regscale_models/vulnerability_mapping.py,sha256=k14azHU7VwryHfXaJdvAMWXs3AqHDr7rnj602bscWQM,6260
446
448
  regscale/models/regscale_models/workflow.py,sha256=uMNVVAn5qR8wxjMP5PHbcvMmvPRe1gn1oclVUpbv52s,1873
447
449
  regscale/models/regscale_models/workflow_action.py,sha256=zMHrvUkTQJlkCj6Xx6wadozBwsVPpObj5GD81LI2VZc,925
448
450
  regscale/models/regscale_models/workflow_instance.py,sha256=15QPr25bVdB3ERPXmQfy2REflVsOZAq6-wZF0GV0MPo,10895
@@ -487,6 +489,7 @@ tests/mocks/xml.py,sha256=WYeZRZfyYmOi4TTvF7I53l3gKF4x1DE1dqy08szPkfQ,261
487
489
  tests/regscale/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
488
490
  tests/regscale/test_about.py,sha256=32YZC8XJW5QkIYIfwEVGIdIxQNUIbyzn3OzVcX_5X24,635
489
491
  tests/regscale/test_authorization.py,sha256=fls5ODCYiu0DdkwXFepO_GM-BP6tRaPmMCZWX6VD2e8,1899
492
+ tests/regscale/test_init.py,sha256=W4deASP6ebAfheqaU5OaiGAfMP6vHGXkJBI4iO98cMQ,3998
490
493
  tests/regscale/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
491
494
  tests/regscale/core/test_api.py,sha256=25AsIT-jg8SrlkPeynUwwm4PvTOrHcRO2Ba_omnNLUY,7512
492
495
  tests/regscale/core/test_app.py,sha256=8HvRRD37pI_x4VjXyjs1g7JWXr-jFIbK_lYst4tLXjI,18922
@@ -514,9 +517,9 @@ tests/regscale/models/test_regscale_model.py,sha256=ZsrEZkC4EtdIsoQuayn1xv2gEGcV
514
517
  tests/regscale/models/test_report.py,sha256=eiSvS_zS0aVeL0HBvtmHVvEzcfF9ZFVn2twj5g8KttY,970
515
518
  tests/regscale/models/test_tenable_integrations.py,sha256=PNJC2Zu6lv1xj7y6e1yOsz5FktSU3PRKb5x3n5YG3w0,4072
516
519
  tests/regscale/models/test_user_model.py,sha256=e9olv28qBApgnvK6hFHOgXjUC-pkaV8aGDirEIWASL4,4427
517
- regscale_cli-6.20.5.0.dist-info/LICENSE,sha256=ytNhYQ9Rmhj_m-EX2pPq9Ld6tH5wrqqDYg-fCf46WDU,1076
518
- regscale_cli-6.20.5.0.dist-info/METADATA,sha256=uhXNlWUvaELYMD0YsHh_2qCqD_OXwj17t9lEeB8jrBw,34899
519
- regscale_cli-6.20.5.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
520
- regscale_cli-6.20.5.0.dist-info/entry_points.txt,sha256=cLOaIP1eRv1yZ2u7BvpE3aB4x3kDrDwkpeisKOu33z8,269
521
- regscale_cli-6.20.5.0.dist-info/top_level.txt,sha256=Uv8VUCAdxRm70bgrD4YNEJUmDhBThad_1aaEFGwRByc,15
522
- regscale_cli-6.20.5.0.dist-info/RECORD,,
520
+ regscale_cli-6.20.6.0.dist-info/LICENSE,sha256=ytNhYQ9Rmhj_m-EX2pPq9Ld6tH5wrqqDYg-fCf46WDU,1076
521
+ regscale_cli-6.20.6.0.dist-info/METADATA,sha256=4wWenW-x93Egn3RCqEkEP59SYaDsBVsq-KPzsB8ZsXs,34899
522
+ regscale_cli-6.20.6.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
523
+ regscale_cli-6.20.6.0.dist-info/entry_points.txt,sha256=cLOaIP1eRv1yZ2u7BvpE3aB4x3kDrDwkpeisKOu33z8,269
524
+ regscale_cli-6.20.6.0.dist-info/top_level.txt,sha256=Uv8VUCAdxRm70bgrD4YNEJUmDhBThad_1aaEFGwRByc,15
525
+ regscale_cli-6.20.6.0.dist-info/RECORD,,
@@ -0,0 +1,94 @@
1
+ import sys
2
+ import types
3
+ import unittest
4
+ from unittest.mock import patch, mock_open, MagicMock
5
+
6
+ airflow_exceptions = types.ModuleType("airflow.exceptions")
7
+ airflow_exceptions.AirflowException = Exception
8
+ sys.modules["airflow.exceptions"] = airflow_exceptions
9
+
10
+ airflow_settings = types.ModuleType("airflow.settings")
11
+ airflow_settings.initialize = lambda: None
12
+ airflow_settings.LAZY_LOAD_PROVIDERS = True
13
+ sys.modules["airflow.settings"] = airflow_settings
14
+
15
+ sys.modules["airflow.configuration"] = types.ModuleType("airflow.configuration")
16
+
17
+ airflow_operators = types.ModuleType("airflow.operators")
18
+ airflow_operators_python = types.ModuleType("airflow.operators.python")
19
+
20
+
21
+ class DummyPythonOperator:
22
+ def __init__(self, *args, **kwargs):
23
+ pass
24
+
25
+
26
+ airflow_operators_python.PythonOperator = DummyPythonOperator
27
+ sys.modules["airflow.operators"] = airflow_operators
28
+ sys.modules["airflow.operators.python"] = airflow_operators_python
29
+
30
+ from regscale.airflow.tasks.init import get_shared_keys, set_shared_config_values # noqa: E402
31
+
32
+
33
+ class TestInitPy(unittest.TestCase):
34
+ @patch("regscale.airflow.tasks.init.execute_click_command")
35
+ @patch("yaml.safe_load", return_value={"foo": "bar"})
36
+ @patch("pathlib.Path.open", new_callable=mock_open, read_data="foo: bar\n")
37
+ def test_get_shared_keys(self, mock_file, mock_yaml, mock_exec):
38
+ """
39
+ If the YAML and dag_run.conf share a key, we should get that key back and execute the click command once.
40
+ """
41
+ dag_context = {"dag_run": MagicMock(conf={"foo": "baz"})}
42
+ shared_keys = get_shared_keys("dummy.yaml", **dag_context)
43
+ self.assertEqual(shared_keys, ["foo"])
44
+ mock_exec.assert_called_once()
45
+
46
+ @patch("regscale.airflow.tasks.init.execute_click_command")
47
+ def test_set_shared_config_values(self, mock_exec):
48
+ """
49
+ When shared keys are found in xcom, set_shared_config_values should call execute_click_command for each.
50
+ """
51
+ dag_context = {
52
+ "dag_run": MagicMock(conf={"foo": "bar", "op_kwargs": {"shared_keys_task": "task1"}}),
53
+ "ti": MagicMock(xcom_pull=MagicMock(return_value=["foo"])),
54
+ }
55
+ set_shared_config_values(shared_keys_task=None, **dag_context)
56
+ mock_exec.assert_called_once()
57
+
58
+ def test_set_shared_config_values_raises(self):
59
+ """
60
+ If op_kwargs is missing from dag_run.conf, set_shared_config_values should raise an AirflowException.
61
+ """
62
+ from airflow.exceptions import AirflowException
63
+
64
+ dag_context = {"dag_run": MagicMock(conf={})}
65
+ with self.assertRaises(AirflowException):
66
+ set_shared_config_values(shared_keys_task=None, **dag_context)
67
+
68
+ @patch("regscale.airflow.tasks.init.execute_click_command")
69
+ def test_set_shared_config_values_warns(self, mock_exec):
70
+ """
71
+ If xcom_pull returns None, set_shared_config_values should log a warning and not call execute_click_command.
72
+ """
73
+ dag_context = {
74
+ "dag_run": MagicMock(conf={"foo": "bar", "op_kwargs": {"shared_keys_task": "task1"}}),
75
+ "ti": MagicMock(xcom_pull=MagicMock(return_value=None)),
76
+ }
77
+ with self.assertLogs(level="WARNING") as log:
78
+ set_shared_config_values(shared_keys_task=None, **dag_context)
79
+ self.assertTrue(any("No shared keys found" in msg for msg in log.output))
80
+ mock_exec.assert_not_called()
81
+
82
+ @patch("yaml.safe_load", return_value={"foo": "bar"})
83
+ @patch("pathlib.Path.open", new_callable=mock_open, read_data="foo: bar\n")
84
+ def test_get_shared_keys_logs_error(self, mock_file, mock_yaml):
85
+ """
86
+ If dag_run is missing from the context, get_shared_keys should log an error and raise KeyError.
87
+ """
88
+ with self.assertLogs(level="ERROR") as log, self.assertRaises(KeyError):
89
+ get_shared_keys("dummy.yaml")
90
+ self.assertTrue(any("context contains" in msg for msg in log.output))
91
+
92
+
93
+ if __name__ == "__main__":
94
+ unittest.main()