Skip to content

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

@stormer78

Description

@stormer78

We're adding continuous coverage-guided fuzzing (cargo-fuzz) and openvtc-core has lots of
good parse surfaces (config, credentials, message types). A few changes make them cleanly
fuzzable:

1. A parsing-only build that drops hardware/network deps

We build the fuzz targets with --no-default-features to avoid the openpgp-card / PCSC
hardware stack. Please make sure openvtc-core compiles and the parse/validate functions
are reachable with --no-default-features
(i.e. the serde models, MessageType,
CredentialKind, DID validation don't transitively require the default hardware/network
features). A dedicated parsing feature that gates exactly the pure surfaces would be ideal.

2. Keep the validators/classifiers pub

We depend on these being public:

  • openvtc_core::MessageType: TryFrom<&str>
  • openvtc_core::CredentialKind::from_credential(serde_json::Value)
  • openvtc_core::config::PublicConfig (Deserialize)
  • openvtc_core::messaging::validate_did(&str)currently may be private; please export
    it (or a small pub validation surface). Our validate_did harness is the only one that
    may fail to build today.

3. Split decrypt from parse for the secured/protected configs

SecuredConfig/ProtectedConfig loading is keyring-decrypt + serde in one step. Please expose
the post-decrypt parse(&[u8]) separately so we can fuzz the deserialization of decrypted
plaintext without needing a keyring or real keys.

4. verify_vrc_proof without a live TDK

messaging::verify_vrc_proof needs a TDK/credential context. A way to verify a VRC against an
injected verifying key (no network, no live TDK) would let us fuzz the proof verifier directly.

5. (Nice to have) #[derive(Arbitrary)] on the config/credential structs + an in-repo fuzz/ workspace.

We have harnesses ready for items reachable today (config parse, message-type, credential-kind)
and will contribute the rest as the hooks land. cargo-fuzz needs nightly; we override the
stable pin for fuzz builds only.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestfuzzingcontinuous fuzzing

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions