Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 37 additions & 22 deletions .github/workflows/validate-manifests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,42 +25,57 @@ jobs:
import glob, hashlib, json, re, sys, urllib.request

EMPTY_SHA256 = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
REQUIRED_KEYS = ("version", "description", "homepage", "license", "url", "hash")
BASE_KEYS = ("version", "description", "homepage", "license")
errors = []

for path in sorted(glob.glob("bucket/*.json")):
try:
manifest = json.load(open(path, encoding="utf-8"))
except Exception as exc:
errors.append(f"{path}: invalid JSON: {exc}")
continue

missing = [k for k in REQUIRED_KEYS if not manifest.get(k)]
if missing:
errors.append(f"{path}: missing required keys: {missing}")
continue

url = manifest["url"]
raw_hash = str(manifest["hash"]).strip()
def verify_target(path, ver, url, raw_hash, label=""):
raw_hash = str(raw_hash or "").strip()
expected = raw_hash.removeprefix("sha256:").lower()
if not url:
errors.append(f"{path}{label}: missing url")
return
if not re.fullmatch(r"[0-9a-f]{64}", expected):
errors.append(f"{path}: invalid SHA-256 hash '{raw_hash}'")
continue
errors.append(f"{path}{label}: invalid SHA-256 hash '{raw_hash}'")
return
if expected == EMPTY_SHA256:
errors.append(f"{path}: placeholder empty-file SHA-256 detected")
continue
errors.append(f"{path}{label}: placeholder empty-file SHA-256 detected")
return

req = urllib.request.Request(url, headers={"User-Agent": "RitualDev-Scoop-CI/1.0"})
try:
with urllib.request.urlopen(req, timeout=30) as resp:
data = resp.read()
actual = hashlib.sha256(data).hexdigest()
if actual != expected:
errors.append(f"{path}: SHA-256 mismatch for {url}\n expected: {expected}\n actual: {actual}")
errors.append(f"{path}{label}: SHA-256 mismatch for {url}\n expected: {expected}\n actual: {actual}")
else:
print(f"OK {path} v{manifest['version']} ({len(data)} bytes) sha256={actual[:16]}...")
print(f"OK {path}{label} v{ver} ({len(data)} bytes) sha256={actual[:16]}...")
except Exception as exc:
errors.append(f"{path}: failed fetching {url}: {exc}")
errors.append(f"{path}{label}: failed fetching {url}: {exc}")

for path in sorted(glob.glob("bucket/*.json")):
try:
manifest = json.load(open(path, encoding="utf-8"))
except Exception as exc:
errors.append(f"{path}: invalid JSON: {exc}")
continue

missing = [k for k in BASE_KEYS if not manifest.get(k)]
if missing:
errors.append(f"{path}: missing required keys: {missing}")
continue

arch_map = manifest.get("architecture")
if isinstance(arch_map, dict) and arch_map:
for arch_name, arch_cfg in arch_map.items():
if not isinstance(arch_cfg, dict) or not arch_cfg.get("url") or not arch_cfg.get("hash"):
errors.append(f"{path} [{arch_name}]: missing 'url' or 'hash'")
continue
verify_target(path, manifest["version"], arch_cfg["url"], arch_cfg["hash"], f" [{arch_name}]")
elif manifest.get("url") and manifest.get("hash"):
verify_target(path, manifest["version"], manifest["url"], manifest["hash"])
else:
errors.append(f"{path}: missing required keys: ['url', 'hash'] (or 'architecture.<arch>.url/hash')")

if errors:
print("\nFAILURES:\n" + "\n".join(errors), file=sys.stderr)
Expand Down
6 changes: 3 additions & 3 deletions bucket/poly.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"version": "0.6.0",
"version": "0.6.2",
"description": "The Universal Polyglot CLI Package & Dependency Orchestrator",
"homepage": "https://poly.ritualdev.in",
"license": "MIT",
"architecture": {
"64bit": {
"url": "https://github.com/RitualDev-Lab/poly/releases/download/v0.6.0/poly-windows-x64.zip",
"hash": "sha256:4b225fb330abde4821b381e82e5cc239d14478c47b84e410b572c928bfe976fe"
"url": "https://github.com/RitualDev-Lab/poly/releases/download/v0.6.2/poly-windows-x64.zip",
"hash": "sha256:f8f2be13337329d2eec9d5290f664fb0a19027466470936195ba3884e3bf732d"
}
},
"bin": "poly.exe",
Expand Down
2 changes: 1 addition & 1 deletion bucket/promptshield.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"suggest": {
"nodejs": "nodejs-lts"
},
"url": "https://github.com/RitualDev-Lab/PromptShield/releases/download/v0.1.0/ritualdev-promptshield-0.1.0.tgz",
"url": "https://github.com/RitualDev-Lab/PromptShield/releases/download/v0%2C1.1/ritualdev-promptshield-0.1.0.tgz",
"hash": "sha256:8f0c3400825d6e006b6443f1ceabccfefdba834a2b7389ab6f290e159e88bfe5",
"extract_dir": "package",
"bin": [
Expand Down