Skip to content

Verify Kokoro model downloads before publish - #60

Draft
Blackspirits wants to merge 3 commits into
upl/review-base-9be1from
fix/kokoro-model-download-sha256-9be1
Draft

Blackspirits wants to merge 3 commits into
upl/review-base-9be1from
fix/kokoro-model-download-sha256-9be1

Conversation

@Blackspirits

@Blackspirits Blackspirits commented Sep 12, 2026

Copy link
Copy Markdown
Owner

Summary

Kokoro TTS downloads two pinned model assets directly from the koth/kokoro.cpp voices_model_files release. Their official SHA-256 digests are published upstream, but the current downloader writes bytes directly to the final paths without authenticating them first. A partial or tampered download can therefore leave a path that later existence checks treat as installed.

This change:

  • pins the official SHA-256 digests for kokoro-v1.1-zh.onnx and voices-v1.1-zh.bin
  • downloads each model to a same-directory .part file
  • verifies SHA-256 before publishing the final path
  • removes temporary files on download, cancellation or integrity failure
  • preserves an existing destination if a replacement attempt fails
  • fails closed before network access when a digest is missing
  • honors cancellation immediately before the verified .part is published
  • leaves the Kokoro runtime archive path unchanged; runtime fail-closed hardening remains isolated in internal PR Fail closed on unknown Kokoro TTS runtime hashes #55
  • adds regressions for both official digests, verified publication, tampered cleanup, preservation of an existing destination, and missing-digest fail-closed behavior

Validation

  • kokoro-v1.1-zh.onnx SHA-256 independently matched the GitHub release asset digest: eefec708cbc7aba8e8129b5c2f7cb92e1fe7d281af1e1dd451592d9ff0714a0d
  • voices-v1.1-zh.bin SHA-256 independently matched the GitHub release asset digest: e678019845e6cfe3b7c34531779396b28f509451b91e6535d5dc09bbf11a4be5
  • no runtime URL/hash behavior is changed by this PR
  • full solution restore passed
  • full solution build passed
  • full solution test suite passed on the first run
  • retry step was not used
  • validation run: #34707666328

Base is upstream 9be10e12d0f04655f2f134718b00679f89b2b15f.

This PR supersedes internal draft #37.

AI assistance: ChatGPT was used to independently re-audit the Kokoro model download/publication path on current upstream, reconfirm official GitHub release digests, strengthen verified publication and cancellation behavior, port the integrity fix, and add regression coverage.

Copy link
Copy Markdown
Owner Author

Independent adversarial re-check: reconfirmed both Kokoro model digests against the official koth/kokoro.cpp voices_model_files release; downloads now stage to .part, verify before publish, preserve an existing destination on failed replacement, remove temporary files on failure/cancellation, and fail before HTTP if the digest is absent. Full CI run #34707666328 passed on the first test run with no retry. No blocker identified. Keep draft; no merge/promotion performed.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant