Skip to content

Cap per-file read to remaining total budget in verify_package - #753

Open
n33miaz wants to merge 1 commit into
developfrom
feature/589-verify-hardening
Open

n33miaz wants to merge 1 commit into
developfrom
feature/589-verify-hardening

Conversation

@n33miaz

@n33miaz n33miaz commented Dec 6, 2026

Copy link
Copy Markdown
Owner

What changes

  • crates/launcher/src/verify.rs: in verify_package, cap the per-file read limit passed to hash_file to limits.max_file_bytes.min(limits.max_total_bytes.saturating_sub(total)), preserving the existing VerifyError::TooLarge diagnostic.
  • crates/launcher/src/verify_tests.rs:
    • Update refuses_case_variant_extra_file_alongside_listed_file to detect filesystem case sensitivity at runtime (dir.0.join("bin/DAEMON").exists()) and skip cleanly on case-insensitive filesystems instead of gating on target_os = "linux".
    • Add refuses_file_exceeding_remaining_total_budget to verify VerifyError::TooLarge when a file exceeds max_total_bytes while staying under max_file_bytes.

Why

  • Previously, verify_package read up to limits.max_file_bytes before checking total > limits.max_total_bytes, allowing a file larger than the remaining budget to be read in full.
  • refuses_case_variant_extra_file_alongside_listed_file assumed Linux implies a case-sensitive filesystem.

How to validate

  • cargo test -p ads-launcher
  • cargo fmt --all --check
  • cargo clippy -p ads-launcher --all-targets -- -D warnings

Regression test: crates/launcher/src/verify_tests.rs::refuses_file_exceeding_remaining_total_budget fails without the fix

Refs #589

Signed-off-by: Neemias Cormino Manso <130704790+n33miaz@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Dec 6, 2026

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

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.

Share

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