|
16 | 16 |
|
17 | 17 | from macaron.config.defaults import defaults
|
18 | 18 | from macaron.config.global_config import global_config
|
19 |
| -from macaron.json_tools import json_extract |
| 19 | +from macaron.provenance.provenance_extractor import ProvenancePredicate |
20 | 20 | from macaron.repo_finder.commit_finder import AbstractPurlType, determine_abstract_purl_type
|
21 | 21 | from macaron.slsa_analyzer.analyze_context import AnalyzeContext
|
22 | 22 | from macaron.slsa_analyzer.asset import AssetLocator
|
@@ -199,6 +199,7 @@ def verify_ci_provenance(analyze_ctx: AnalyzeContext, ci_info: CIInfo, download_
|
199 | 199 | )
|
200 | 200 |
|
201 | 201 | if not sub_verified:
|
| 202 | + logger.info("Sub asset not verified: %s", sub_asset["name"]) |
202 | 203 | return False
|
203 | 204 |
|
204 | 205 | if sub_verified:
|
@@ -322,10 +323,8 @@ def _verify_slsa(
|
322 | 323 | cwd=download_path,
|
323 | 324 | timeout=defaults.getint("slsa.verifier", "timeout", fallback=120),
|
324 | 325 | )
|
325 |
| - |
326 | 326 | output = verifier_output.stdout.decode("utf-8")
|
327 |
| - verified = "PASSED: Verified SLSA provenance" in output |
328 |
| - |
| 327 | + verified = "PASSED: SLSA verification passed" in output |
329 | 328 | log_path = os.path.join(global_config.build_log_path, f"{os.path.basename(source_path)}.slsa_verifier.log")
|
330 | 329 | with open(log_path, mode="a", encoding="utf-8") as log_file:
|
331 | 330 | logger.info("Storing SLSA verifier output for %s to %s", asset_name, log_path)
|
@@ -385,9 +384,7 @@ def determine_provenance_slsa_level(
|
385 | 384 | predicate = provenance_payload.statement.get("predicate")
|
386 | 385 | build_type = None
|
387 | 386 | if predicate:
|
388 |
| - build_type = json_extract(predicate, ["buildDefinition", "buildType"], str) |
389 |
| - if not build_type: |
390 |
| - build_type = json_extract(predicate, ["buildType"], str) |
| 387 | + build_type = ProvenancePredicate.get_build_type(provenance_payload.statement) |
391 | 388 |
|
392 | 389 | if build_type == "https://github.com/slsa-framework/slsa-github-generator/generic@v1" and verified_l3:
|
393 | 390 | # 3. Provenance is created by the SLSA GitHub generator and verified.
|
|
0 commit comments