Skip to content

feat(fuzz): EncString parser fuzz harness (PRD §11.4)#29

Merged
UnbreakableMJ merged 1 commit into
mainfrom
enc-string-fuzz
Jun 16, 2026
Merged

feat(fuzz): EncString parser fuzz harness (PRD §11.4)#29
UnbreakableMJ merged 1 commit into
mainfrom
enc-string-fuzz

Conversation

@UnbreakableMJ

Copy link
Copy Markdown
Contributor

What

Adds a cargo-fuzz / libFuzzer harness for the security-critical Bitwarden "type 2" EncString parser (crates/vault-core/src/enc_string.rs) — the PRD §11.4 / M7 groundwork toward the v0.1 tag. This delivers the harness; the ≥ 24 h soak is a maintainer step.

EncString::parse base64-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.toml carries its own empty [workspace], and the root Cargo.toml also excludes fuzz. 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 internal unsafe live 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.
  • README pointer + CHANGELOG entry.

Verification

  • Main workspace unaffected: cargo build --workspace, fmt --check, fresh-isolated clippy -D warnings, cargo test --workspace --all-targets, cargo deny check, both headless builds — all green (fuzz excluded).
  • Harness well-formed: cargo +nightly fuzz build enc_string_parse compiles.
  • Smoke run: cargo +nightly fuzz run enc_string_parse -- -max_total_time=30 did ~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

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>
@UnbreakableMJ
UnbreakableMJ merged commit 653eb71 into main Jun 16, 2026
8 checks passed
@UnbreakableMJ
UnbreakableMJ deleted the enc-string-fuzz branch June 16, 2026 08:13
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