fix(security): verify on-disk catalog cache signature on startup load - #25
Merged
Conversation
At startup the app read the cached catalog directly into state without verifying its Ed25519 signature, so a locally modified cache could influence DLL download destinations before a verified refresh. - dll-catalog: add pub load_verified_cache() that always requires the sidecar signature to verify (load_cached_catalog keeps its enforcement-gated behavior for the fetch-with-cache path via a shared helper) - src-tauri: load the startup cache through load_verified_cache(); on a missing/invalid/unsigned cache, fall back to the signed embedded manifest instead of trusting unverified bytes - test: a cache whose sidecar is signed with the wrong key is rejected Closes #20
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #20. At startup the app read the cached catalog directly into
state.catalogwithout verifying its Ed25519 signature, so a locally modifiedCache/catalog.jsoncould influence DLL download destinations before a verified refresh. This routes the startup load through a signature-required loader and falls back to the signed embedded manifest when the cache cannot be verified.Changes
crates/dll-catalog/src/lib.rs: addpub fn load_verified_cache()that always requires the.sigsidecar to verify;load_cached_catalogkeeps its enforcement-gated behavior for the fetch-with-cache path via a shared helper. New test: a cache whose sidecar is signed with the wrong key is rejected.src-tauri/src/lib.rs: startup loads throughload_verified_cache(); on missing/invalid/unsigned cache, falls back toembedded_fallback_catalog()instead of trusting unverified bytes.Proof
cargo test -p dll-catalog-> 55 passed (incl.verified_cache_rejects_sidecar_from_wrong_key)cargo check -p dlssyncandcargo check -p dlssync --features nexus-> Finishedcargo clippy -p dll-catalog -- -D warnings-> cleancargo fmt --all -- --check-> cleanCloses #20