feat(fuzz): EncString parser fuzz harness (PRD §11.4)#29
Merged
Conversation
Adds a cargo-fuzz / libFuzzer harness for the security-critical Bitwarden "type 2" EncString parser — the §11.4 / M7 groundwork toward the v0.1 tag. The target feeds arbitrary input to `EncString::parse` and, on success, asserts the parse → serialize → parse round-trip is stable (catches panics and parser/serializer disagreement). - fuzz/: a standalone workspace (own empty [workspace]); root Cargo.toml also `exclude`s it. cargo-fuzz needs nightly + a sanitizer runtime, so isolating it keeps the CI gates (fmt/clippy/test/deny/headless) and the workspace `forbid(unsafe_code)` untouched — the target's `#![no_main]` + libFuzzer's internal unsafe live only here. - docs/fuzzing.md: prerequisites, run command, the ≥24h soak, corpus seeding. - README pointer + CHANGELOG entry. Verified: `cargo +nightly fuzz build` compiles; a 30s smoke run did ~2.1M iterations with no finding. The full ≥24h soak is a maintainer step. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
What
Adds a cargo-fuzz / libFuzzer harness for the security-critical Bitwarden "type 2"
EncStringparser (crates/vault-core/src/enc_string.rs) — the PRD §11.4 / M7 groundwork toward thev0.1tag. This delivers the harness; the ≥ 24 h soak is a maintainer step.EncString::parsebase64-decodes attacker-influenceable cache/sync strings into IV/ciphertext/MAC, so it's the right thing to fuzz. The target feeds arbitrary input and, on a successful parse, asserts the parse → serialize → parse round-trip is stable — catching panics and any parser/serializer disagreement.Layout (isolated from the main workspace)
The harness lives in a standalone
fuzz/workspace:fuzz/Cargo.tomlcarries its own empty[workspace], and the rootCargo.tomlalsoexcludesfuzz. cargo-fuzz needs a nightly toolchain + a sanitizer runtime, so this isolation keeps every existing CI gate (fmt/clippy -D warnings/test/deny/ both headless builds) and the workspace#![forbid(unsafe_code)]untouched — the target's#![no_main]and libFuzzer's internalunsafelive only here. The fuzz harness is intentionally not a CI job.fuzz/fuzz_targets/enc_string_parse.rs— the target.docs/fuzzing.md— prerequisites, run command, the ≥ 24 h soak, corpus seeding.Verification
cargo build --workspace,fmt --check, fresh-isolatedclippy -D warnings,cargo test --workspace --all-targets,cargo deny check, both headless builds — all green (fuzz excluded).cargo +nightly fuzz build enc_string_parsecompiles.cargo +nightly fuzz run enc_string_parse -- -max_total_time=30did ~2.1M iterations with no finding.Out of scope (still pending for the v0.1 tag, per PRD M7)
The actual ≥ 24 h fuzz soak run, a PQC transport feature flag, the hardening pass, and the §11.2 two-week daily-driver attestation. Once those land, a separate slice cuts
v0.1.0(version bump + CHANGELOG date + PRD/PROJECTS reconcile).🤖 Generated with Claude Code