mirror of
https://github.com/foxhole-team/foxhole-guard.git
synced 2026-10-21 10:45:41 +02:00
099e864dd7
Fix profile mutation, notification authorization, runtime ownership and WebApp isolation boundaries. Refresh native dependencies and verify the shipped dependency inventory. Add white accent and monochrome themes with the OpenWrt launcher icon; preserve application icons and flags in color. Restore standard update-source actions. Pin published Core 0.0.5, reuse authenticated release artifacts and run Android boundary tests across supported API levels. Update F-Droid source recipe and release notes.
37 lines
1.7 KiB
Python
37 lines
1.7 KiB
Python
#!/usr/bin/env python3
|
|
"""Check the authenticated Core release against the exact source revision and shipped ABI bytes."""
|
|
|
|
import hashlib
|
|
import json
|
|
from pathlib import Path
|
|
import shutil
|
|
import sys
|
|
|
|
|
|
def verify(source, release, revision, abis, output=None):
|
|
manifest = json.loads((release / "MANIFEST.json").read_text())
|
|
provenance = json.loads((release / "RELEASE.json").read_text())
|
|
if manifest["git"]["commit"] != revision or manifest["git"]["dirty"] or provenance["main_commit"] != revision:
|
|
raise ValueError("Core release does not belong to the pinned clean source commit")
|
|
if (release / "Cargo.lock").read_bytes() != (source / "Cargo.lock").read_bytes():
|
|
raise ValueError("Core release dependency lock differs from pinned source")
|
|
rows = {row["abi"]: row for row in manifest["libs"]}
|
|
if len(rows) != len(manifest["libs"]) or set(rows) != {"arm64-v8a", "armeabi-v7a"}:
|
|
raise ValueError("Core release ABI inventory is invalid")
|
|
for abi in abis:
|
|
row = rows[abi]
|
|
library = release / "jniLibs" / abi / "libfoxhole_native.so"
|
|
data = library.read_bytes()
|
|
if len(data) != row["bytes"] or hashlib.sha256(data).hexdigest() != row["sha256"]:
|
|
raise ValueError("Core release ELF differs from authenticated manifest")
|
|
if output is not None:
|
|
destination = output / abi / library.name
|
|
destination.parent.mkdir(parents=True, exist_ok=True)
|
|
shutil.copy2(library, destination)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
verify(Path(sys.argv[1]), Path(sys.argv[2]), sys.argv[3], sys.argv[4].split(),
|
|
Path(sys.argv[5]) if len(sys.argv) > 5 else None)
|
|
print("Authenticated Core release matches pinned source and ELF hashes")
|