4040from macaron .slsa_analyzer .git_service .base_git_service import NoneGitService
4141from macaron .slsa_analyzer .package_registry import PACKAGE_REGISTRIES
4242from 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
4444from macaron .slsa_analyzer .provenance .slsa import SLSAProvenanceData
4545from macaron .slsa_analyzer .registry import registry
4646from macaron .slsa_analyzer .specs .ci_spec import CIInfo
@@ -111,7 +111,13 @@ def __init__(self, output_path: str, build_log_path: str) -> None:
111111 # Create database tables: all checks have been registered so all tables should be mapped now
112112 self .db_man .create_tables ()
113113
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 :
115121 """Run the analysis and write results to the output path.
116122
117123 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) -
125131 The path to the SBOM.
126132 skip_deps : bool
127133 Flag to skip dependency resolution.
134+ prov_payload : InToToPayload | None
135+ The provenance intoto payload for the main software component.
128136
129137 Returns
130138 -------
@@ -154,7 +162,11 @@ def run(self, user_config: dict, sbom_path: str = "", skip_deps: bool = False) -
154162 )
155163
156164 # 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+ )
158170
159171 if main_record .status != SCMStatus .AVAILABLE or not main_record .context :
160172 logger .info ("Analysis has failed." )
@@ -255,6 +267,7 @@ def run_single(
255267 config : Configuration ,
256268 analysis : Analysis ,
257269 existing_records : dict [str , Record ] | None = None ,
270+ prov_payload : InTotoPayload | None = None ,
258271 ) -> Record :
259272 """Run the checks for a single repository target.
260273
@@ -269,6 +282,8 @@ def run_single(
269282 The current analysis instance.
270283 existing_records : dict[str, Record] | None
271284 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.
272287
273288 Returns
274289 -------
@@ -306,6 +321,7 @@ def run_single(
306321 analyze_ctx .dynamic_data ["expectation" ] = self .expectations .get_expectation_for_target (
307322 analyze_ctx .component .purl .split ("@" )[0 ]
308323 )
324+ analyze_ctx .dynamic_data ["provenance" ] = prov_payload
309325 analyze_ctx .check_results = self .perform_checks (analyze_ctx )
310326
311327 return Record (
0 commit comments