Repository navigation
Share the updater's verified stream loop and split run() - #32
Merged
Merged
Conversation
The download path and the privileged .deb copy each carried their own bounded read/verify/write loop. Both now use stream_verified(), so a future hardening change to how update bytes are streamed and checked reaches both paths. Callers keep their own final checks (exact size and SHA-256 for downloads) and finalize the signature verifier themselves. run() in main.rs had grown to 370 lines and ~62 branches. Its callbacks move unchanged into register_settings, register_source_actions, register_preview (with a flat show_preview helper), register_updates and start_polling, following register_drive_checks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 24 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
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
Two behaviour-preserving refactors from a CodeHawk audit (findings CQ-001 and CQ-002).
src/updater.rs: one verified stream loop (CQ-002)The download path (
verify_download_progress) and the privileged.debcopy (copy_verified_package) each had their own bounded read → signature-verify → write loop. Both now call a singlestream_verified(reader, writer, limit, verifier, on_chunk):take(limit + 1)bound, checked slicing and "exceeds expected size" error;on_chunk, then keep their exact-size and digest checks;verifier.finalize()themselves, in the same order as before.This is the code that decides whether an update is trusted, so a future hardening change now reaches both paths at once.
src/main.rs: splitrun()(CQ-001)run()was 370 lines with about 62 branches. It's now 34 lines, and its callbacks move unchanged into:register_settings: language, links, debug log, folder shortcuts, reduce motion, Windows restart-as-administratorregister_source_actions: theaction!/action_with!buttonsregister_preview, plus a flatshow_preview()that replaces the 6-level nested preview handlerregister_updates, which returns the sharedUpdatesstart_polling, which returns the 100 ms timer;run()holds it as_timerThis follows the existing
register_drive_checkspattern. Drive monitoring still starts before the source callbacks are registered.Notes for reviewers
Rc::clone(&state)becomesRc::clone(state)now thatstateis a reference.deny.tomlalready ignores them with reasons and a 2026-12-15 expiry, andbincodeisn't in the resolved graph.Testing
cargo fmt --checkandcargo clippy --locked --all-targets -- -D warningsare clean on Linux.cargo test --locked --no-fail-fastpasses, including the updater's corruption, truncation and oversize tests and the audit suite.#[cfg(windows)]restart-as-administrator block now lives inregister_settings.🤖 Generated with Claude Code