You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Build-time model download (scripts/download-models.ts) skips SHA-256 verification #1715
Model artifacts are downloaded with curl -L and no SHA-256 verification — no pinned digest, no post-download comparison, no load-time check. Because the download runs at build time, a substituted (compromised upstream, redirect hijack, MITM on a CI runner, malicious mirror) model is then code-signed and notarized as authentic and shipped to every user. The GGUF is parsed by native C++ (llama.cpp) inside the daemon, so a hostile artifact is both an integrity failure and a memory-safety attack surface running with full daemon authority.
The security posture doc previously claimed "SHA-256-pinned model downloads" — it was aspirational. This is the one unmet leg of the T9 supply-chain hardening bar.
Duplicate of #1497 (same finding, filed 2026-07-05, already assigned). Folded the ADR-058 reference and the scripts/download-models.ts detail into #1497.
changed the title [-]Model download has no SHA-256 integrity verification (supply-chain, Critical)[/-][+]Build-time model download (scripts/download-models.ts) skips SHA-256 verification[/+]on Jul 23, 2026
This issue (still open): the build-time script scripts/download-models.ts:38 — still a bare curl -L --progress-bar -o ${MODEL_PATH} ${MODEL_URL} with no hash check. This path bakes the model into the shipped, signed, notarized bundle, so a build-time substitution ships as authentic. PR Verify SHA-256 for every model catalog entry, pin HF commit SHAs #1543 never touched this file.
So the runtime path is hardened; the build/bundle path is not. That's the Critical gap.
Acceptance criteria
scripts/download-models.ts verifies the downloaded artifact against a pinned SHA-256 (reuse the same pinned digests already in model_manager.rs), fail-hard + delete on mismatch
Load-time verification of the on-disk GGUF (companion; see ADR-058)
Context
ADR-058 — Model Artifact Integrity Verification (nodespace-docs/decisions/058-model-artifact-integrity-verification.md)
Model-artifact integrity is now enforced at both ends of the build-time embedding-model path (ADR-058, Threat T9).
Build-time (scripts/download-models.ts): the URL is pinned to HF commit 0188c9bf…, MODEL_SHA256 is pinned, curl -fL --proto =https fails hard on HTTP errors, and the artifact is stream-verified after download (and any pre-existing file is re-verified) — on mismatch the file is deleted and the script throws, so an unverified model can never be bundled/signed/notarized.
Load-time (packages/nlp-engine): EmbeddingService::initialize() computes the on-disk GGUF's SHA-256 and refuses to load on mismatch beforeLlamaModel::load_from_file, closing the post-install tamper window. Added EMBEDDING_MODEL_SHA256, compute_file_sha256 (64 KB streaming), verify_model_integrity, EmbeddingError::IntegrityError, and the sha2 dep.
Acceptance criteria — all met
Pinned SHA-256 next to MODEL_URL + matching constant at the Rust load site
Post-download digest compare, fail hard + delete on mismatch
Load-time verification, refuse to load on mismatch
HTTPS with normal cert validation (digest is the authoritative gate)
Model rotation updates the pinned digest in the same change (contract documented in both the script and config.rs)
Verification
Pinned digest 3e24342164b3d94991ba9692fdc0dd08e3fd7362e0aacc396a9a5c54a544c3b7 matches the authoritative HF LFS metadata for the pinned commit and the shipped local model.
Live run of the script verified the real 146 MB model in ~0.2 s.
New Rust unit tests green (NIST sha256("abc") vector, mismatch rejection, unreadable-file error, digest-format invariant); cargo clippy clean; cargo test --lib green; no test regressions (integration tests skip when the model is absent / use the real default config).
Independent adversarial review: CONFIRMED-GOOD across all 7 scrutiny points.
Only the pinned Q8_0 bytes pass the load gate; resolve_model_path's .f16/.gguf fallbacks and a custom model_path still resolve but are rejected at load if they aren't the pinned artifact — documented on resolve_model_path so nothing but the pinned model reaches native llama.cpp.
Activity
malibio commentedon Jul 23, 2026
Duplicate of #1497 (same finding, filed 2026-07-05, already assigned). Folded the ADR-058 reference and the
scripts/download-models.tsdetail into #1497.[-]Model download has no SHA-256 integrity verification (supply-chain, Critical)[/-][+]Build-time model download (scripts/download-models.ts) skips SHA-256 verification[/+]malibio commentedon Jul 23, 2026
Reopened — this is NOT a duplicate of #1497 after all
I closed this as a duplicate of #1497, but on verifying the code that was wrong. The two cover different download paths:
packages/agent/src/local_agent/model_manager.rs— now pins a per-entry SHA-256, pins the HF commit SHA, and stream-verifies with hard-fail. Solid and complete.scripts/download-models.ts:38— still a barecurl -L --progress-bar -o ${MODEL_PATH} ${MODEL_URL}with no hash check. This path bakes the model into the shipped, signed, notarized bundle, so a build-time substitution ships as authentic. PR Verify SHA-256 for every model catalog entry, pin HF commit SHAs #1543 never touched this file.So the runtime path is hardened; the build/bundle path is not. That's the Critical gap.
Acceptance criteria
scripts/download-models.tsverifies the downloaded artifact against a pinned SHA-256 (reuse the same pinned digests already inmodel_manager.rs), fail-hard + delete on mismatchContext
nodespace-docs/decisions/058-model-artifact-integrity-verification.md)nodespace-docs/architecture/security-posture.mdmstomar125 commentedon Jul 24, 2026
✅ Completed — merged in PR #1730
Model-artifact integrity is now enforced at both ends of the build-time embedding-model path (ADR-058, Threat T9).
Build-time (
scripts/download-models.ts): the URL is pinned to HF commit0188c9bf…,MODEL_SHA256is pinned,curl -fL --proto =httpsfails hard on HTTP errors, and the artifact is stream-verified after download (and any pre-existing file is re-verified) — on mismatch the file is deleted and the script throws, so an unverified model can never be bundled/signed/notarized.Load-time (
packages/nlp-engine):EmbeddingService::initialize()computes the on-disk GGUF's SHA-256 and refuses to load on mismatch beforeLlamaModel::load_from_file, closing the post-install tamper window. AddedEMBEDDING_MODEL_SHA256,compute_file_sha256(64 KB streaming),verify_model_integrity,EmbeddingError::IntegrityError, and thesha2dep.Acceptance criteria — all met
MODEL_URL+ matching constant at the Rust load siteconfig.rs)Verification
3e24342164b3d94991ba9692fdc0dd08e3fd7362e0aacc396a9a5c54a544c3b7matches the authoritative HF LFS metadata for the pinned commit and the shipped local model.sha256("abc")vector, mismatch rejection, unreadable-file error, digest-format invariant);cargo clippyclean;cargo test --libgreen; no test regressions (integration tests skip when the model is absent / use the real default config).Follow-up filed
chat/mod.rs) has no equivalent load-time gate (its download is verified viamodel_manager.rs, but an on-disk swap isn't re-checked at load). Same class of surface; tracked separately.Note (deliberate)
Only the pinned Q8_0 bytes pass the load gate;
resolve_model_path's.f16/.gguffallbacks and a custommodel_pathstill resolve but are rejected at load if they aren't the pinned artifact — documented onresolve_model_pathso nothing but the pinned model reaches native llama.cpp.Exclude ai-chat nodes from embedding/vectorization (closes #1696) (#1733