Skip to content

fix(fuzz): repair broken fuzz_public_key target#109

Merged
avrabe merged 1 commit into
mainfrom
chore/audit-followups
May 11, 2026
Merged

fix(fuzz): repair broken fuzz_public_key target#109
avrabe merged 1 commit into
mainfrom
chore/audit-followups

Conversation

@avrabe
Copy link
Copy Markdown
Contributor

@avrabe avrabe commented May 10, 2026

The `fuzz_public_key` target referenced four APIs that have since been removed from `src/lib/src/signature/keys.rs`:

  • `PublicKey::from_openssh`
  • `PublicKey::from_any`
  • `PublicKeySet::from_openssh`
  • `SecretKey::from_openssh`

OpenSSH ingestion and the polymorphic auto-detect entry point are gone; only raw-bytes, PEM, and DER parsing remain on `PublicKey` and `SecretKey`.

Fix

Rewrote the target against the current surface only. New oracles:

  • Round-trip preservation: `PublicKey::from_bytes` / `to_bytes` / `from_bytes` equality
  • PEM and DER re-parse correctness
  • Determinism of `PublicKey::attach_default_key_id`

Added a module comment documenting the dropped APIs to prevent reintroduction.

Handled `SecretKey::to_bytes` / `to_pem` returning `Zeroizing<…>` via deref coercion.

Verification

  • `cd fuzz && cargo build --bin fuzz_public_key` clean
  • `cd fuzz && cargo build --bins` clean
  • `cargo build --workspace --release` clean

Originally flagged in audit PR #98 as a pre-existing broken target out of scope at the time.

The target referenced four APIs that no longer exist on
`wsc::signature::keys`:

  - `PublicKey::from_openssh`
  - `PublicKey::from_any`
  - `PublicKeySet::from_openssh`
  - `SecretKey::from_openssh`

OpenSSH ingestion and the polymorphic `from_any` auto-detect entry point
were removed from the public-key surface; only raw-bytes, PEM, and DER
parsing remain. Audit PR #98 (parser hardness) flagged the build failure
as a pre-existing leftover, out of scope for that change.

This commit rewrites the target against the current surface only:

  - PublicKey::{from_bytes,from_pem,from_der} + round-trip oracles
  - SecretKey::{from_bytes,from_pem,from_der} + round-trip
    (handling the `Zeroizing<Vec<u8>>` / `Zeroizing<String>` returns of
    `SecretKey::to_bytes` / `to_pem` via deref coercion)
  - determinism check on `PublicKey::attach_default_key_id`

A module-level comment documents the dropped APIs so the next reviewer
does not re-introduce them. No core source touched; only the fuzz
target was changed.

Verified:
  - `cd fuzz && cargo build --bin fuzz_public_key`  -> clean
  - `cd fuzz && cargo build --bins`                 -> clean
  - `cargo build --workspace --release`             -> clean

Trace: skip

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@avrabe avrabe merged commit 64f4f54 into main May 11, 2026
@avrabe avrabe deleted the chore/audit-followups branch May 11, 2026 03:56
avrabe added a commit that referenced this pull request May 11, 2026
Patch release bundling four merged PRs:
  #107 — cargo-deny CI step hardening (closes #103)
  #108 — discharge lemma_le64_injective Verus admit (audit C-1 partial)
  #109 — repair fuzz_public_key target (audit follow-up from #98)
  #110 — clear 3 RUSTSEC advisories via dep bumps (fixes #102)

Companion work on 0.8.2+next:
  #111 — criterion benches for signature verification (#89)
  #112 — lift Kani wasm_module mask; document merkle + format

See CHANGELOG.md for the full release notes.

Trace: skip

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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