Files
alkstore/tasks/fuzz-target-name-validation.md
T

71 lines
2.7 KiB
Markdown

---
id: fuzz-target-name-validation
name: Fuzz target — `name_validation` (core name validation)
status: pending
depends_on: [fuzz-scaffold]
scope: narrow
risk: trivial
impact: component
level: implementation
tags: [wave-7, fuzzing]
---
## Description
The §3.3 target: `name_validation` — the cheapest target, driving core's
already-`pub` validation surface (`alkstore/src/validation.rs`:
`validate_name` over all `NameKind`s, `validate_shared_name`,
`validate_local_name`). No exposure needed.
- **`fuzz_targets/name_validation.rs`** + **`shared/src/
name_validation.rs`** (invariants + `#[cfg(test)]` replay),
`[[bin]]` entry. Input: arbitrary `&[u8]` → strings (lossy + a
structured path), lengths spanning the caps, all `NameKind`s.
- **Invariants** (§3.3, verbatim): total (no panic on any input);
deterministic accept/reject (same input → same verdict, pinned by
double-invocation in the invariant fn); rejection only via typed
`Error::InvalidName` (or `ReservedName` where the reserved-prefix
rule fires — both are the taxonomy's typed rejections; nothing else,
no panic); the reserved-prefix rule (`__alkstore_`, ADR-014 §1's
shared namespace) rejects in every casing/boundary form the fuzzer
finds; length-boundary exactness at the cap (the ±1 neighborhood —
a name at the cap is accepted, one past it rejected, per the pinned
rule).
- **Seeds** via `gen_fuzz_seeds.py`'s `name_validation` function:
cap-boundary lengths (±1, ±2), the reserved prefix in plain /
suffixed / embedded forms, empty and whitespace-only strings, unicode
and control-char shapes, the reserved listener-reconnected string.
Corpus committed; gitignore negation.
- **`fuzz/README.md`** targets-table row.
Low expected yield (the doc says so) — the value is the entry-point
domain guard demonstrated over the whole string space, the gate's
guard-order discipline made continuous.
## Acceptance Criteria
- [ ] `fuzz_targets/name_validation.rs` + `shared/src/
name_validation.rs` exist; `cargo fuzz build` builds the target
- [ ] All §3.3 invariants implemented and exercised by both the fuzz
path and the replay module
- [ ] Seed corpus committed, deterministic-generated, gitignore
negation in place
- [ ] `cargo test --manifest-path fuzz/shared/Cargo.toml` green;
`shared` clippy/fmt gates green
- [ ] Root workspace gates still green
## References
- docs/research/fuzzing.md §3.3 (target spec), §4, §7
- docs/architecture/core-contract.md §Naming / reserved namespace
- docs/architecture/decisions/014-naming-and-reserved-namespace.md §1
(the reserved-prefix rule the target demonstrates)
- alkstore/src/validation.rs (the surface)
## Notes
> To be filled by implementation agent
## Summary
> To be filled on completion