Skip to content

Model downloads skip SHA-256 verification for every model #1497

Closed

Description

@malibio

Overview

Every entry in the model catalog ships an empty sha256, and perform_download skips integrity verification when the hash is empty. Multi-GB GGUF files — including the locked default model — load into llama.cpp with integrity delegated entirely to HuggingFace transport, over a moving /resolve/main/ reference.

Problem Statement

The verification machinery exists (sha256_file, mismatch → delete) but is never armed because no catalog entry carries a hash. A MITM, a compromised/re-uploaded HuggingFace blob, or a wrong-file swap would be accepted and run silently.

Proposed Solution

Populate sha256 for the locked default plus promotion candidates; make an empty hash a hard error for non-trial models; pin the HuggingFace commit SHA in the URL instead of /resolve/main/.

Acceptance Criteria

  • Default/locked models carry a real sha256
  • Empty hash is a hard error for non-trial catalog entries
  • Download URLs pin a commit SHA (not a moving ref)
  • Code passes bun run quality:fix; tests pass

Technical Specifications

Reference Files

  • packages/agent/src/local_agent/model_manager.rs (catalog sha256: "", bypass around the empty-hash check)
  • Context: ADR-046

Related Issues

  • (none)

Activity

  1. malibio commented on Jul 6, 2026

    @malibio
    CollaboratorAuthor

    Baseline (worktree issue-1497-model-sha256-verification): Frontend 3944 passed, 2 failed (architecture-benchmarks.test.ts performance variance, pre-existing/unrelated). Proceeding with Rust changes to model_manager.rs.

  2. self-assigned this
    on Jul 6, 2026
  3. added a commit that references this issue on Jul 6, 2026
    652d8ea
  4. malibio commented on Jul 23, 2026

    @malibio
    CollaboratorAuthor

    Re-confirmed in the July 2026 security review (Critical). Decision + verification contract now documented: ADR-058 — Model Artifact Integrity Verification (nodespace-docs/decisions/058-model-artifact-integrity-verification.md): pin SHA-256 next to the model URL, verify-or-delete at download, and verify again at load. Note the review also confirmed the standalone scripts/download-models.ts path (curl -L, no digest) in addition to the catalog perform_download path.

  5. malibio commented on Jul 23, 2026

    @malibio
    CollaboratorAuthor

    Companion item (was S-19 in the review): also verify the on-disk GGUF against the pinned digest at load time (packages/nlp-engine/src/config.rs:70), not only at download — closes the post-install tamper window. Covered by ADR-058.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions