40
40
from macaron .slsa_analyzer .git_service .base_git_service import NoneGitService
41
41
from macaron .slsa_analyzer .package_registry import PACKAGE_REGISTRIES
42
42
from macaron .slsa_analyzer .provenance .expectations .expectation_registry import ExpectationRegistry
43
- from macaron .slsa_analyzer .provenance .intoto import InTotoV01Payload
43
+ from macaron .slsa_analyzer .provenance .intoto import InTotoPayload , InTotoV01Payload
44
44
from macaron .slsa_analyzer .provenance .slsa import SLSAProvenanceData
45
45
from macaron .slsa_analyzer .registry import registry
46
46
from macaron .slsa_analyzer .specs .ci_spec import CIInfo
@@ -111,7 +111,13 @@ def __init__(self, output_path: str, build_log_path: str) -> None:
111
111
# Create database tables: all checks have been registered so all tables should be mapped now
112
112
self .db_man .create_tables ()
113
113
114
- def run (self , user_config : dict , sbom_path : str = "" , skip_deps : bool = False ) -> int :
114
+ def run (
115
+ self ,
116
+ user_config : dict ,
117
+ sbom_path : str = "" ,
118
+ skip_deps : bool = False ,
119
+ prov_payload : InTotoPayload | None = None ,
120
+ ) -> int :
115
121
"""Run the analysis and write results to the output path.
116
122
117
123
This method handles the configuration file and writes the result html reports including dependencies.
@@ -125,6 +131,8 @@ def run(self, user_config: dict, sbom_path: str = "", skip_deps: bool = False) -
125
131
The path to the SBOM.
126
132
skip_deps : bool
127
133
Flag to skip dependency resolution.
134
+ prov_payload : InToToPayload | None
135
+ The provenance intoto payload for the main software component.
128
136
129
137
Returns
130
138
-------
@@ -154,7 +162,11 @@ def run(self, user_config: dict, sbom_path: str = "", skip_deps: bool = False) -
154
162
)
155
163
156
164
# Analyze the main target.
157
- main_record = self .run_single (main_config , analysis )
165
+ main_record = self .run_single (
166
+ main_config ,
167
+ analysis ,
168
+ prov_payload = prov_payload ,
169
+ )
158
170
159
171
if main_record .status != SCMStatus .AVAILABLE or not main_record .context :
160
172
logger .info ("Analysis has failed." )
@@ -255,6 +267,7 @@ def run_single(
255
267
config : Configuration ,
256
268
analysis : Analysis ,
257
269
existing_records : dict [str , Record ] | None = None ,
270
+ prov_payload : InTotoPayload | None = None ,
258
271
) -> Record :
259
272
"""Run the checks for a single repository target.
260
273
@@ -269,6 +282,8 @@ def run_single(
269
282
The current analysis instance.
270
283
existing_records : dict[str, Record] | None
271
284
The mapping of existing records that the analysis has run successfully.
285
+ prov_payload : InToToPayload | None
286
+ The provenance intoto payload for the analyzed software component.
272
287
273
288
Returns
274
289
-------
@@ -306,6 +321,7 @@ def run_single(
306
321
analyze_ctx .dynamic_data ["expectation" ] = self .expectations .get_expectation_for_target (
307
322
analyze_ctx .component .purl .split ("@" )[0 ]
308
323
)
324
+ analyze_ctx .dynamic_data ["provenance" ] = prov_payload
309
325
analyze_ctx .check_results = self .perform_checks (analyze_ctx )
310
326
311
327
return Record (
0 commit comments