fluidattacks_core_models 13.1.0__tar.gz → 14.0.0__tar.gz

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.
Files changed (36) hide show
  1. {fluidattacks_core_models-13.1.0 → fluidattacks_core_models-14.0.0}/.gitignore +2 -0
  2. {fluidattacks_core_models-13.1.0 → fluidattacks_core_models-14.0.0}/PKG-INFO +1 -1
  3. {fluidattacks_core_models-13.1.0 → fluidattacks_core_models-14.0.0}/fluidattacks_core/models/state_machines/__init__.py +3 -3
  4. {fluidattacks_core_models-13.1.0 → fluidattacks_core_models-14.0.0}/fluidattacks_core/models/state_machines/component_orchestrator.py +8 -0
  5. {fluidattacks_core_models-13.1.0 → fluidattacks_core_models-14.0.0}/fluidattacks_core/models/state_machines/root_scanner.py +0 -8
  6. {fluidattacks_core_models-13.1.0 → fluidattacks_core_models-14.0.0}/pyproject.toml +1 -1
  7. {fluidattacks_core_models-13.1.0 → fluidattacks_core_models-14.0.0}/tests/test_component_orchestrator.py +43 -5
  8. {fluidattacks_core_models-13.1.0 → fluidattacks_core_models-14.0.0}/tests/test_root_scanner.py +0 -43
  9. {fluidattacks_core_models-13.1.0 → fluidattacks_core_models-14.0.0}/uv.lock +1 -1
  10. {fluidattacks_core_models-13.1.0 → fluidattacks_core_models-14.0.0}/.envrc +0 -0
  11. {fluidattacks_core_models-13.1.0 → fluidattacks_core_models-14.0.0}/build/default.nix +0 -0
  12. {fluidattacks_core_models-13.1.0 → fluidattacks_core_models-14.0.0}/build/filter.nix +0 -0
  13. {fluidattacks_core_models-13.1.0 → fluidattacks_core_models-14.0.0}/flake.lock +0 -0
  14. {fluidattacks_core_models-13.1.0 → fluidattacks_core_models-14.0.0}/flake.nix +0 -0
  15. {fluidattacks_core_models-13.1.0 → fluidattacks_core_models-14.0.0}/fluidattacks_core/models/__init__.py +0 -0
  16. {fluidattacks_core_models-13.1.0 → fluidattacks_core_models-14.0.0}/fluidattacks_core/models/py.typed +0 -0
  17. {fluidattacks_core_models-13.1.0 → fluidattacks_core_models-14.0.0}/fluidattacks_core/models/scanners/__init__.py +0 -0
  18. {fluidattacks_core_models-13.1.0 → fluidattacks_core_models-14.0.0}/fluidattacks_core/models/scanners/apk_config.py +0 -0
  19. {fluidattacks_core_models-13.1.0 → fluidattacks_core_models-14.0.0}/fluidattacks_core/models/scanners/common_config.py +0 -0
  20. {fluidattacks_core_models-13.1.0 → fluidattacks_core_models-14.0.0}/fluidattacks_core/models/scanners/containers_sca_config.py +0 -0
  21. {fluidattacks_core_models-13.1.0 → fluidattacks_core_models-14.0.0}/fluidattacks_core/models/scanners/cspm_config.py +0 -0
  22. {fluidattacks_core_models-13.1.0 → fluidattacks_core_models-14.0.0}/fluidattacks_core/models/scanners/dast_config.py +0 -0
  23. {fluidattacks_core_models-13.1.0 → fluidattacks_core_models-14.0.0}/fluidattacks_core/models/scanners/loader.py +0 -0
  24. {fluidattacks_core_models-13.1.0 → fluidattacks_core_models-14.0.0}/fluidattacks_core/models/scanners/sast_config.py +0 -0
  25. {fluidattacks_core_models-13.1.0 → fluidattacks_core_models-14.0.0}/fluidattacks_core/models/scanners/sbom_config.py +0 -0
  26. {fluidattacks_core_models-13.1.0 → fluidattacks_core_models-14.0.0}/fluidattacks_core/models/scanners/sca_config.py +0 -0
  27. {fluidattacks_core_models-13.1.0 → fluidattacks_core_models-14.0.0}/fluidattacks_core/models/scanners/scan_config.py +0 -0
  28. {fluidattacks_core_models-13.1.0 → fluidattacks_core_models-14.0.0}/fluidattacks_core/models/scanners/sniffs_config.py +0 -0
  29. {fluidattacks_core_models-13.1.0 → fluidattacks_core_models-14.0.0}/fluidattacks_core/models/state_machines/types.py +0 -0
  30. {fluidattacks_core_models-13.1.0 → fluidattacks_core_models-14.0.0}/import-linter.cfg +0 -0
  31. {fluidattacks_core_models-13.1.0 → fluidattacks_core_models-14.0.0}/mypy.ini +0 -0
  32. {fluidattacks_core_models-13.1.0 → fluidattacks_core_models-14.0.0}/ruff.toml +0 -0
  33. {fluidattacks_core_models-13.1.0 → fluidattacks_core_models-14.0.0}/tests/__init__.py +0 -0
  34. {fluidattacks_core_models-13.1.0 → fluidattacks_core_models-14.0.0}/tests/test_loader_env.py +0 -0
  35. {fluidattacks_core_models-13.1.0 → fluidattacks_core_models-14.0.0}/tests/test_model_scanner.py +0 -0
  36. {fluidattacks_core_models-13.1.0 → fluidattacks_core_models-14.0.0}/tests/test_state_machines.py +0 -0
@@ -1,3 +1,4 @@
1
+ dist/
1
2
  dist-*/
2
3
  /.cargo-cache
3
4
  target/
@@ -5,3 +6,4 @@ target/
5
6
  .venv/
6
7
  .vscode/settings.json
7
8
  .zed/settings.json
9
+ *.so
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: fluidattacks_core_models
3
- Version: 13.1.0
3
+ Version: 14.0.0
4
4
  Summary: Fluid Attacks Core Models Library
5
5
  Author-email: Development <development@fluidattacks.com>
6
6
  License: MPL-2.0
@@ -1,6 +1,8 @@
1
1
  from fluidattacks_core.models.state_machines.component_orchestrator import (
2
2
  ComponentScanOptions,
3
+ ResolvesScanOptions,
3
4
  StateMachineComponentOrchestrator,
5
+ TracesScanOptions,
4
6
  )
5
7
  from fluidattacks_core.models.state_machines.root_scanner import (
6
8
  ContextualizesScanInput,
@@ -8,8 +10,6 @@ from fluidattacks_core.models.state_machines.root_scanner import (
8
10
  PerRootScanOptions,
9
11
  StateMachineExecutePerRootInput,
10
12
  TJobNameSegment,
11
- TracesScanInput,
12
- TracesScanOptions,
13
13
  TStorageKey,
14
14
  )
15
15
  from fluidattacks_core.models.state_machines.types import (
@@ -26,6 +26,7 @@ __all__ = [
26
26
  "ContextualizesScanInput",
27
27
  "ContextualizesScanOptions",
28
28
  "PerRootScanOptions",
29
+ "ResolvesScanOptions",
29
30
  "StateMachine",
30
31
  "StateMachineCloningInput",
31
32
  "StateMachineComponentOrchestrator",
@@ -36,6 +37,5 @@ __all__ = [
36
37
  "TCloningTrigger",
37
38
  "TJobNameSegment",
38
39
  "TStorageKey",
39
- "TracesScanInput",
40
40
  "TracesScanOptions",
41
41
  ]
@@ -20,6 +20,14 @@ class ComponentScanOptions(BaseModel):
20
20
  user_email: TVisibleAscii = Field(..., min_length=1)
21
21
 
22
22
 
23
+ class ResolvesScanOptions(ComponentScanOptions):
24
+ pass
25
+
26
+
27
+ class TracesScanOptions(ComponentScanOptions):
28
+ group_name: TStorageKey
29
+
30
+
23
31
  TComponentOptions = TypeVar("TComponentOptions", bound=ComponentScanOptions)
24
32
 
25
33
 
@@ -44,10 +44,6 @@ class ContextualizesScanOptions(PerRootScanOptions):
44
44
  pass
45
45
 
46
46
 
47
- class TracesScanOptions(PerRootScanOptions):
48
- pass
49
-
50
-
51
47
  TOptions = TypeVar("TOptions", bound=PerRootScanOptions)
52
48
 
53
49
 
@@ -98,7 +94,3 @@ class StateMachineExecutePerRootInput(BaseModel, Generic[TOptions]):
98
94
 
99
95
  class ContextualizesScanInput(StateMachineExecutePerRootInput[ContextualizesScanOptions]):
100
96
  pass
101
-
102
-
103
- class TracesScanInput(StateMachineExecutePerRootInput[TracesScanOptions]):
104
- pass
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "fluidattacks_core_models"
3
- version = "13.1.0"
3
+ version = "14.0.0"
4
4
  description = "Fluid Attacks Core Models Library"
5
5
  authors = [{ name = "Development", email = "development@fluidattacks.com" }]
6
6
  license = { text = "MPL-2.0" }
@@ -5,7 +5,9 @@ from pydantic import ValidationError
5
5
 
6
6
  from fluidattacks_core.models.state_machines.component_orchestrator import (
7
7
  ComponentScanOptions,
8
+ ResolvesScanOptions,
8
9
  StateMachineComponentOrchestrator,
10
+ TracesScanOptions,
9
11
  )
10
12
  from fluidattacks_core.models.state_machines.root_scanner import (
11
13
  MACHINE_NAME_DIGEST_LENGTH,
@@ -14,7 +16,7 @@ from fluidattacks_core.models.state_machines.root_scanner import (
14
16
  )
15
17
 
16
18
 
17
- class _ResolvesScanOptions(ComponentScanOptions):
19
+ class _OptionsWithAnExtraField(ComponentScanOptions):
18
20
  seed_domain: str
19
21
 
20
22
 
@@ -155,15 +157,51 @@ def test_machine_name_is_injective() -> None:
155
157
 
156
158
 
157
159
  def test_orchestrator_binds_the_options_type_it_is_parameterized_with() -> None:
158
- resolves = _ResolvesScanOptions(
160
+ extended = _OptionsWithAnExtraField(
159
161
  config_id="123456",
160
162
  entity_name="acme",
161
163
  seed_domain="acme.com",
162
164
  user_email="test@fluidattacks.com",
163
165
  )
164
- machine_input = StateMachineComponentOrchestrator[_ResolvesScanOptions].model_validate(
165
- _wire_payload(options=resolves)
166
+ machine_input = StateMachineComponentOrchestrator[_OptionsWithAnExtraField].model_validate(
167
+ _wire_payload(options=extended)
166
168
  )
167
169
  assert json.loads(machine_input.execution_options)["seed_domain"] == "acme.com"
168
170
  with pytest.raises(ValidationError):
169
- StateMachineComponentOrchestrator[_ResolvesScanOptions].model_validate(_wire_payload())
171
+ StateMachineComponentOrchestrator[_OptionsWithAnExtraField].model_validate(_wire_payload())
172
+
173
+
174
+ def test_resolves_options_add_no_fields_of_their_own() -> None:
175
+ options = ResolvesScanOptions(
176
+ config_id="123456", entity_name="acme", user_email="test@fluidattacks.com"
177
+ )
178
+ with pytest.raises(ValidationError):
179
+ ResolvesScanOptions.model_validate({**options.model_dump(), "seed_domain": "acme.com"})
180
+
181
+
182
+ def _traces_options(**overrides: str) -> TracesScanOptions:
183
+ arguments: dict[str, str] = {
184
+ "config_id": "123456",
185
+ "entity_name": "nickname",
186
+ "group_name": "acme",
187
+ "user_email": "test@fluidattacks.com",
188
+ }
189
+ arguments.update(overrides)
190
+ return TracesScanOptions(**arguments)
191
+
192
+
193
+ def test_traces_options_declare_the_group_the_orchestrator_does_not_carry() -> None:
194
+ options = _traces_options()
195
+ assert set(options.model_dump()) == set(ComponentScanOptions.model_fields) | {"group_name"}
196
+ with pytest.raises(ValidationError):
197
+ TracesScanOptions.model_validate(_options().model_dump())
198
+
199
+
200
+ def test_traces_group_name_is_a_storage_key_and_reaches_the_scanner_on_the_wire() -> None:
201
+ for value in ("a/b", "..", "acme corp", "_leading", ""):
202
+ with pytest.raises(ValidationError):
203
+ _traces_options(group_name=value)
204
+ machine_input = StateMachineComponentOrchestrator[TracesScanOptions].model_validate(
205
+ _wire_payload(options=_traces_options(), scanner_name="traces-scan")
206
+ )
207
+ assert json.loads(machine_input.execution_options)["group_name"] == "acme"
@@ -11,8 +11,6 @@ from fluidattacks_core.models.state_machines.root_scanner import (
11
11
  ContextualizesScanOptions,
12
12
  PerRootScanOptions,
13
13
  StateMachineExecutePerRootInput,
14
- TracesScanInput,
15
- TracesScanOptions,
16
14
  )
17
15
 
18
16
 
@@ -267,44 +265,3 @@ def test_execute_per_root_machine_name_is_injective() -> None:
267
265
  assert len(names) == 2
268
266
  assert len(masked) == 2
269
267
  assert len(roots) == 2
270
-
271
-
272
- def _traces_options(**overrides: str) -> TracesScanOptions:
273
- arguments: dict[str, str] = {
274
- "config_id": "123456",
275
- "group_name": "acme",
276
- "root_nickname": "nickname",
277
- "user_email": "test@fluidattacks.com",
278
- }
279
- arguments.update(overrides)
280
- return TracesScanOptions(**arguments)
281
-
282
-
283
- def _traces_input(options: TracesScanOptions | None = None) -> TracesScanInput:
284
- return TracesScanInput.model_validate(
285
- {
286
- "job_definition": "traces_run",
287
- "job_queue": "traces",
288
- "scanner_name": "traces-scan-run",
289
- "options": options if options is not None else _traces_options(),
290
- }
291
- )
292
-
293
-
294
- def test_traces_scan_options_are_exactly_the_shared_per_root_fields() -> None:
295
- options = _traces_options()
296
- assert set(options.model_dump()) == set(PerRootScanOptions.model_fields)
297
- assert TracesScanOptions.model_validate_json(options.model_dump_json()) == options
298
-
299
-
300
- def test_traces_scan_input_keeps_the_seven_wire_keys_the_machine_reads() -> None:
301
- dumped = _traces_input().to_wire()
302
- assert set(dumped) == {
303
- "configId",
304
- "executionOptions",
305
- "groupName",
306
- "jobDefinition",
307
- "jobQueue",
308
- "rootNickname",
309
- "scannerName",
310
- }
@@ -187,7 +187,7 @@ wheels = [
187
187
 
188
188
  [[package]]
189
189
  name = "fluidattacks-core-models"
190
- version = "13.1.0"
190
+ version = "14.0.0"
191
191
  source = { editable = "." }
192
192
  dependencies = [
193
193
  { name = "pydantic" },