test(fuzz): the four-target fuzz sidecar (w5-fuzz-harness)

The family standing rule (anything worth fuzzing gets fuzzed) on the
crate's ingress surfaces, per the alkgit convention:

- fuzz_targets/{exec_parse,fingerprint,key_decode,terminal_params} —
  thin fuzz_target! wrappers over four ingress surfaces:
  - exec_parse: the production parse path (from_utf8-fallback ingress
    shape), differentially paired against a from-spec grammar oracle;
    typed routing classes + determinism.
  - fingerprint: blob parse + the single fingerprint path; the
    SHA256:/unpadded-base64 contract shape via a from-spec
    base64 round-trip oracle; the committed ssh-keygen -lf vectors
    replayed inside the gate.
  - key_decode: the production decode arm (the #[doc(hidden)]
    decode_key_arm exposure, routed through itself); typed-class +
    bounded-fixed-message invariants; passphrase-shape robustness
    drive on the underlying decode.
  - terminal_params: the pty_request conversion via the #[doc(hidden)]
    terminal_params exposure; exact clamp, verbatim term, the
    reserved-modes {} JSON shape, serialized-shape determinism.
- shared/ — the invariant logic as a stable-clean library; the
  corpus gate (cargo test --manifest-path fuzz/shared/Cargo.toml)
  replays every committed seed through the batteries and joins
  AGENTS.md's verification list.
- corpus/<target>/ committed seeds + the deterministic
  gen_fuzz_seeds.py (no-op-diff verified).
- run-detached.sh + nightly pin; the sidecar excluded from the root
  workspace (workspace + package excludes; publish dry-run clean).

Exposure shape decided + recorded per target (README + lib.rs doc
comments): fingerprint needs none (fully public ingress); the rest
are #[doc(hidden)] re-exports of the production surfaces, never
forks. Detached campaigns ran per target (600 s default budget, fork
mode): all four clean; the two findings of the first round are
recorded in the task file (the harness oracle's double-/-strip bug;
the PPK echo fixed in the preceding commit).

Verification: corpus gate green (11 tests); scripts/matrix.sh green;
taskgraph validate clean.
This commit is contained in:
glm-5.3-flash committed 2026-10-30 11:44:21 +00:00
1 parent a5fb03e7c6
commit d37cbc0c8a
93 files changed
+4833 -14

No files matched your search

+7 -7
View File
@@ -79,11 +79,11 @@ use russh::ChannelOpenFailure;
/// skeleton probe's `ExecRoute::Git`/`Pipe` split, extended by the
/// `w3-git-mapping` grammar with the declined-with-reason class).
#[derive(Debug, Clone, PartialEq, Eq)]
pub(crate) enum ExecRoute {
pub enum ExecRoute {
/// A git-parseable command — routes to the git row. The repo path
/// is the normalized argument grammar (quotes, leading `/`, one
/// trailing `.git`); validation (`alkgit::validate_repo_id`) is
/// the git row's gate ([`crate::git_map`]).
/// the git row's gate (the `crate::git_map` module).
Git {
service: GitServiceRoute,
repo: String,
@@ -99,10 +99,10 @@ pub(crate) enum ExecRoute {
}
/// The git service the exec grammar recognized — the ADR-016 wire
/// strings, as the door-side form of [`alkgit::Service`] (the seam maps
/// strings, as the door-side form of `alkgit::Service` (the seam maps
/// them verbatim; this type keeps the parse core feature-free).
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub(crate) enum GitServiceRoute {
pub enum GitServiceRoute {
/// `git-upload-pack` — fetch.
UploadPack,
/// `git-receive-pack` — push.
@@ -114,7 +114,7 @@ pub(crate) enum GitServiceRoute {
/// the validation gate; that one needs `alkgit`'s grammar, this type
/// is the parse core's).
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub(crate) enum ExecDecline {
pub enum ExecDecline {
/// A known non-serving git service arrived on the wire:
/// `git-send-pack` / `git-upload-archive` (POC-3 §2 — the honest
/// surface; ADR-016's refusal).
@@ -136,10 +136,10 @@ impl ExecDecline {
}
}
/// The exec-grammar parse — the wave-2 [`classify_exec`] probe's
/// The exec-grammar parse — the wave-2 `classify_exec` probe's
/// replacement, its unit rows migrated (see the grammar section for
/// the exact shape rules).
pub(crate) fn parse_exec(command: &str) -> ExecRoute {
pub fn parse_exec(command: &str) -> ExecRoute {
let (token, argument) = match command.split_once(' ') {
Some((token, argument)) => (token, Some(argument)),
None => (command, None),
+19
View File
@@ -93,6 +93,13 @@ pub use config::SessionSeam;
#[cfg(feature = "tunnel")]
pub use config::TunnelListenSeam;
pub use config::{DialConfig, Limits, ServeConfig};
/// Fuzz-visible surface (`#[doc(hidden)]`, `w5-fuzz-harness`): the exec
/// grammar's parse path (`dispatch.rs`) — the `fuzz/` sidecar's
/// `exec_parse` target drives the production parse, never a fork. Not
/// documented API: the grammar is the dispatch seam's, not a public-API
/// promise.
#[doc(hidden)]
pub use dispatch::{ExecDecline, ExecRoute, GitServiceRoute, parse_exec};
pub use error::{AdapterError, DialError, KeySourceError, OpError, OpenDeclineReason};
pub use fingerprint::fingerprint;
/// Contract-test surface (`#[doc(hidden)]`): the per-connection auth
@@ -103,6 +110,11 @@ pub use fingerprint::fingerprint;
#[doc(hidden)]
pub use handler::SessionHandler;
pub use host_key::{HostKeyPolicy, PresentedHostKey, RejectAll};
/// Fuzz-visible surface (`#[doc(hidden)]`, `w5-fuzz-harness`): the
/// decrypt-at-use chain's decode arm (`key_source.rs`, the production
/// `decrypt_and_decode` conversion). Not documented API.
#[doc(hidden)]
pub use key_source::decode_key_arm;
pub use key_source::{HostKeySource, KeySource, VaultHostKeySource, VaultKeySource};
/// Contract-test surface (`#[doc(hidden)]`): the spawn-and-return
/// plumbing (`ADR-006 decision 4`, see `serve.rs`) — the mechanics the
@@ -110,3 +122,10 @@ pub use key_source::{HostKeySource, KeySource, VaultHostKeySource, VaultKeySourc
/// real wire to pin the constraint as tests. Not documented API.
#[doc(hidden)]
pub use serve::{report_exit_status_then_close, spawn_serving_path};
/// Fuzz-visible surface (`#[doc(hidden)]`, `w5-fuzz-harness`, under
/// `session`): the `pty_request` args → `TerminalParamsWire`
/// conversion (`tty_map.rs`, OQ-44's reserved modes). Not documented
/// API.
#[cfg(feature = "session")]
#[doc(hidden)]
pub use tty_map::terminal_params;
+1 -1
View File
@@ -215,7 +215,7 @@ pub(crate) fn clamp_u16(value: u32) -> u16 {
/// negotiation section): SSH ttymodes → the **reserved modes JSON
/// `{}`** (alktty OQ-44's reservation — the map is honest: nothing
/// is carried, exactly what the reservation asks).
pub(crate) fn terminal_params(
pub fn terminal_params(
term: &str,
cols: u32,
rows: u32,