Skip to content

feat(core): feature-gated Arbitrary derives on parse-surface types (#124)#126

Merged
stormer78 merged 1 commit into
mainfrom
feat/arbitrary-derives-124
Jun 14, 2026
Merged

feat(core): feature-gated Arbitrary derives on parse-surface types (#124)#126
stormer78 merged 1 commit into
mainfrom
feat/arbitrary-derives-124

Conversation

@stormer78

Copy link
Copy Markdown
Contributor

Closes the last actionable ask on #124 — item 5's derive half. The fuzz consumer (comment) confirmed items 2–4 (PR #125) are exactly what they need and explicitly requested feature-gated #[derive(Arbitrary)] on the config/credential parse surfaces for structure-aware fuzzing. The fuzz/ workspace + structure-aware targets remain their contribution.

What's here

  • New optional arbitrary feature on openvtc-core (off by default): arbitrary = ["dep:arbitrary", "chrono/arbitrary"]. Nightly fuzz builds opt in; the default and --no-default-features dependency graphs are unchanged.
  • #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] on the self-contained parse-surface types:
    • PublicConfig and its local tree (ConfigProtectionType, Logs, LogMessage, LogFamily)
    • MessageType, CredentialKind
  • ProtectedConfig intentionally excluded — it cascades into foreign VRC/credential types that don't implement Arbitrary. This matches the consumer's note that the verify_vrc_proof_with_key harness (needs a constructed VRC + keypair) lands after the derives.
  • Seam test: PublicConfig::arbitrary(&mut Unstructured) constructs from raw bytes and serde round-trips — proves the harness path end to end.
  • CI: the no-default-features job now also checks the exact fuzz build shape (--no-default-features --features arbitrary) and runs the seam test, so the feature can't bitrot.

Gate

  • cargo fmt
  • cargo clippy --workspace --all-targets -D warnings — default, --features arbitrary, and --no-default-features
  • cargo test --workspace + cargo test -p openvtc-core --features arbitrary
  • cargo deny check — advisories/bans/licenses/sources ok (arbitrary/derive_arbitrary are MIT/Apache-2.0)

Closes #124.

)

Closes the remaining actionable ask on issue #124 (item 5, derive half):
the fuzz consumer asked for feature-gated `#[derive(Arbitrary)]` on the
config/credential parse surfaces so their cargo-fuzz harnesses can do
structure-aware fuzzing. The `fuzz/` workspace stays their contribution.

- New optional `arbitrary` feature on openvtc-core (off by default):
  `arbitrary = ["dep:arbitrary", "chrono/arbitrary"]`. Nightly fuzz builds
  opt in; no change to the default or `--no-default-features` dep graph.
- `#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]` on the
  self-contained parse-surface types: `PublicConfig` (+ its `ConfigProtectionType`,
  `Logs`, `LogMessage`, `LogFamily` tree), `MessageType`, `CredentialKind`.
  `ProtectedConfig` is intentionally excluded — it cascades into foreign
  VRC/credential types that don't implement `Arbitrary`; this matches the
  consumer's note that the VRC harness lands after the derives.
- Seam test: `PublicConfig::arbitrary(&mut Unstructured)` constructs from raw
  bytes and serde round-trips, proving the harness path end to end.
- CI: the no-default-features job now also checks the exact fuzz build shape
  (`--no-default-features --features arbitrary`) and runs the seam test, so
  the feature can't bitrot.

Gate: cargo fmt; clippy --workspace --all-targets -D warnings (default,
`--features arbitrary`, and `--no-default-features`); cargo test --workspace;
cargo test -p openvtc-core --features arbitrary; cargo deny check — all green.
`arbitrary`/`derive_arbitrary` are MIT/Apache-2.0 (licenses ok).

Signed-off-by: Glenn Gore <glenn.g@affinidi.com>
@stormer78 stormer78 requested a review from a team as a code owner June 14, 2026 08:53
@stormer78 stormer78 merged commit 75610b0 into main Jun 14, 2026
9 of 13 checks passed
@stormer78 stormer78 deleted the feat/arbitrary-derives-124 branch June 14, 2026 08:54
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.

Add fuzzing support: no-default-features parsing path, pub validators, decrypt/parse split

1 participant