This commit is contained in:
1 parent
a1a223f53f
commit
c03a8d9d98
6 files changed
+406
-238
No files matched your search
+15
-7
@@ -58,7 +58,7 @@ def main() -> int:
|
||||
parser.add_argument("--evidence-out", default="")
|
||||
args = parser.parse_args()
|
||||
|
||||
marqdo = Path(args.marqdo_bin)
|
||||
marqdo = Path(args.marqdo_bin).resolve()
|
||||
if not marqdo.is_file():
|
||||
fail("set --marqdo-bin or MARQDO_BIN to a real core CLI binary")
|
||||
archive = Path(args.archive).resolve()
|
||||
@@ -190,17 +190,25 @@ def main() -> int:
|
||||
"query_hits": len(query_report["hits"]),
|
||||
"database": check_report["payload"]["database"],
|
||||
}
|
||||
print(json.dumps(evidence, indent=2, sort_keys=True, ensure_ascii=False))
|
||||
if args.evidence_out:
|
||||
Path(args.evidence_out).write_text(
|
||||
json.dumps(evidence, indent=2, sort_keys=True, ensure_ascii=False) + "\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
finally:
|
||||
run([str(marqdo), "tool", "remove", "knowledge"], env=env)
|
||||
remaining = run([str(marqdo), "tool", "list"], env=env)
|
||||
if "knowledge" in remaining:
|
||||
fail("tool was not removed")
|
||||
core_info_path = marqdo.with_name("RELEASE_INFO.json")
|
||||
source_path = marqdo.with_name("SOURCE_SHA")
|
||||
if core_info_path.is_file() and source_path.is_file():
|
||||
core_info = json.loads(core_info_path.read_text(encoding="utf-8"))
|
||||
core_source = source_path.read_text(encoding="utf-8").strip()
|
||||
core_digest = sha256_file(marqdo)
|
||||
if (core_info.get("source_sha") != core_source
|
||||
or core_info.get("binaries", {}).get("marqdo", {}).get("sha256") != core_digest):
|
||||
fail("core executable does not match its release metadata")
|
||||
evidence.update(core_source_sha=core_source, core_binary_sha256=core_digest)
|
||||
rendered = json.dumps(evidence, indent=2, sort_keys=True, ensure_ascii=False)
|
||||
print(rendered)
|
||||
if args.evidence_out:
|
||||
Path(args.evidence_out).write_text(rendered + "\n", encoding="utf-8")
|
||||
print("smoke: OK")
|
||||
return 0
|
||||
|
||||
|
||||
Reference in new issue
Block a user