Skip to content

fix: reject whitespace-padded venue ids across host and SDK - #55

Open
mfw78 wants to merge 2 commits into
test/hard-fail-missing-wasmsfrom
fix/venue-id-whitespace
Open

fix: reject whitespace-padded venue ids across host and SDK#55
mfw78 wants to merge 2 commits into
test/hard-fail-missing-wasmsfrom
fix/venue-id-whitespace

Conversation

@mfw78

@mfw78 mfw78 commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

What

Rejects (never trims) empty or whitespace-padded venue ids across all three surfaces: host-side registry.rs, host-side client.rs import validation, and SDK-side client.rs.

  • videre-host/src/registry.rs: VenueId::new now rejects empty input and any surrounding whitespace (was: whitespace-only input only); InvalidVenueId's error message updated to match.
  • videre-host/src/client.rs: the wire venue id validation doc comment updated to reflect the tightened check; test renamed and extended to cover leading/trailing/newline/NBSP padding, not just blank input.
  • videre-sdk/src/client.rs: VenueId gained InvalidVenueId (via thiserror), a validating VenueId::new(impl Into<Cow<'static, str>>), FromStr, TryFrom<String>, and TryFrom<&str>. The unvalidated From<String>/From<&str> impls are removed, so no infallible path accepts arbitrary strings. from_static stays const and asserts at const evaluation via a hand-rolled const padded() helper (manual UTF-8 boundary-char decode plus const char::is_whitespace).
  • videre-sdk/src/keeper.rs: Keeper::new tightened from impl Into<VenueId> to VenueId (only the identity conversion remained); test call sites updated to VenueId::from_static.
  • videre-macros/src/venue_marker.rs: updated alongside the VenueId construction changes.

Why

Closes #39

A whitespace-padded venue id ( cow, cow , cow\n, cow\u{a0}) previously slipped past validation, letting two spellings of what should be one id both resolve. Reject-not-trim keeps the id's spelling exact rather than silently rewriting it, so a padded id can never be installed or accepted at any of the three boundaries: host registry construction, the host's wasm import seam, and the SDK client.

Testing

All on a fresh clone of fix/venue-id-whitespace (a6c9442) inside nix develop (rustc 1.94.0, cargo-nextest 0.9.127), with RUSTFLAGS="-D warnings" and --locked throughout, mirroring .github/workflows/ci.yml.

  • cargo clippy -p videre-host -p videre-sdk -p videre-macros --all-targets --all-features --locked -- -D warnings - clean, no warnings.
  • cargo test --doc -p videre-host -p videre-sdk -p videre-macros --all-features --locked - ok; 0 doctests in each of the three crates (no doc examples on the touched surface).
  • RUSTDOCFLAGS="-D warnings" cargo doc --no-deps -p videre-host -p videre-sdk -p videre-macros --locked - documented all three, no warnings.
  • videre-macros changed, so the guest wasms were rebuilt: cargo build --release --target wasm32-wasip2 --locked -p echo-venue -p echo-client -p echo-keeper -p flaky-venue -p logging-venue - all 5 built.

AI Assistance

Implemented with claude-fable-5, red-teamed with claude-opus-5, PR description written by claude-sonnet-5.

mfw78 added 2 commits August 6, 2026 20:14
Both VenueId types now refuse empty and whitespace-padded ids, rejecting
rather than trimming so two spellings never collapse into one id (the
exact-equality manifest_id_check depends on that). Host-side VenueId::new
tightens from whitespace-only to any surrounding whitespace. SDK-side
VenueId gains a validating constructor, FromStr, and TryFrom in place of
the unvalidated From impls; from_static stays const and fails padded
literals at const evaluation. The venue marker macro rejects a padded id
literal at expansion, before the manifest comparison. The runtime half
(manifest names) is upstream nullislabs/nexum-runtime#110.

Closes #39
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