#6663 [Engine] Model files are hashed once at install but never verified at load; damaged or swapped shards are served silently

open · @xvcezrqpbxtpzblrt · 0 评论 · 去 GitHub 看

BenchmarksSetup & installNVIDIA / CUDAModels & quantsDocumentation

说明

Thanks for the report. Please read the contributing guide first and search open and closed issues before filing.

**Write only what you saw.** Where a claim below is from reading code rather than a run, it is marked as static analysis in Reproduction status.

> This report is a static source review of the official tree. It was not reproduced on a running build; Reproduction status below says so explicitly.

### Area


[Engine]  (speed, kernels, models, the server and API)

### Desktop app, Terminal or source?


All routes (Desktop app, Terminal and source all load shards through the same engine)

### What happened
Strata advertises that every model file has a fixed SHA-256 and size and that a mismatching file is deleted and stops the install. That check runs **only inside setup, at install time**. At load time there is no integrity check at all: the engine accepts whatever bytes are in the shard and serves the resulting output. Setup also does not re-hash a model it already has, and files installed before the hashes were added are explicitly kept as they are.

Result: a shard that is damaged (bad sector, interrupted copy, disk/SSD bit rot), replaced by hand, downloaded from an unverified mirror, or simply predates the pinned hashes is loaded without any warning or error. The user gets silent wrong answers or a confusing startup failure, with no message pointing at the file. The protection that would help every single user is effectively switched off for the entire lifetime of the model after installation.

Evidence, verbatim (documentation; paths are repository-relative):

- `docs/SAFETY.md:18` — "**Downloads are checked.** Updates come from a signed feed. Every model file has a fixed SHA-256 and size, and an install stops if the pinned version of a file is gone (the details are [below](#how-downloads-are-checked))."
- `docs/SAFETY.md:121` — "**Model files.** Every model file that `setup.py` downloads has a fixed SHA-256 and size, written in the code, so the check"
- `docs/SAFETY.md:124-125` — "tensor). A file that does not match is deleted and the install stops. A file whose size on the server is not the pinned / size stops it before the download starts."
- `docs/SAFETY.md:130-131` — "- Starting a model does not check its files, and running setup again for a model you have does not download or hash them / again. A file installed before these hashes existed is kept as it is."
- `docs/SAFETY.md:127-129` — "- If the pinned version of a file is gone from Hugging Face, the install stops and says to update Strata. It does not take / the repository's current file instead. A tester can set `STRATA_ALLOW_UNPINNED=1` to take the current file anyway, without / the check. It is off by default, and setup says so when it is set."

This is a documentation-backed description of the current behavior, not an observed failure: `docs/SAFETY.md:5` states "Everything here comes from reading the code of this version. Each section names the files, so you or anyone you trust can check it."

### Smallest steps or command that reproduce it
Not reproduced locally; no hardware run was performed. A way to verify the hypothesis would be:

1. Install a model through the normal setup so that the pinned hashes are known.
2. Change one byte in one shard (or use a shard installed before the pinned hashes existed).
3. Start the model with the normal command, for example `strata launch --family qwen --model q2_0 --no-tui`.
4. Check whether startup or the first request reports the bad file.

No output from step 3 or 4 is claimed here. This needs a real model install and a GPU to confirm.

### Expected
A model file whose bytes or size no longer match the pinned value is reported at load time with the file name, so the user can reinstall that file instead of debugging nonsense answers or a crash that gives no clue.

### Actual
Per `docs/SAFETY.md:130-131`, no check happens at load time. A pre-hash file or a file changed after install is used as-is.

### Reproduction status
Unconfirmed static analysis (I read the official documentation and the settings register; I did not see it fail on hardware).

### Strata version

0.2.19 · engine 0.1.65 (source tree under review, static analysis; not a running-build query)

### Graphics card, memory and system
Not applicable to the finding. No hardware-specific claim is made: the load path is shared by all cards and all three routes. Hardware details would be needed only for the verification run described above.

### Model, size and settings
Any model installed through setup. No special setting is involved. There is no load-time verification switch in `docs/SETTINGS.md`: the only related switches are install-time ones (`STRATA_SKIP_SHA256`, `STRATA_ALLOW_UNPINNED`), described in `docs/SAFETY.md:127-129` and `docs/SAFETY.md:141-142`.

### Logs
Not available. This report comes from reading source and documentation, not from a run.

### Why every user benefits
Every user loads model files. The SHA-256 pins already exist in the code, so the cost of this gap is paid by everyone who ever has a damaged, replaced, hand-copied or legacy file: wrong output, a misleading startup error, or hours of debugging something that is simply a bad byte on disk. A load-time check (at minimum a size check with an opt-in full hash for large shards) turns an invisible data-integrity failure into a clear, actionable message. It does not require new hardware, a new model format or any user action to take effect, so the improvement reaches all users on all backends, including people who never set an environment variable.

### What would confirm or refute it

- Confirm: corrupt one shard after install, start the model, and observe that neither startup nor the first request names the file.
- Refute: point to load-time code that checks each shard against `REPO_PINS` (or another pinned hash source) and reports a mismatch with the file name; `docs/SAFETY.md:130-131` would then need to be corrected.

### Duplicate search

Searched open+closed issues for `model file SHA-256`, `model integrity check load`, `STRATA_ALLOW_UNPINNED`. Closest, none a duplicate: #5938 (closed, a single transient download failure aborting an IQ1_M install), #5703 (closed, a benchmark avoiding a re-hash), #4726 (open, "use files I have" not registered — a GUI store gap, not integrity checking). None asks for a load-time integrity check.

本站相关内容

相关页面的快捷入口。