Wave icon indicating copy to clipboard operation
Wave copied to clipboard

Offer explicit byte and node budgets for WSON parsing and serialization

Open LunaStev opened this issue 1 month ago • 0 comments

Motivation

WSON already bounds nesting (and allows an explicit serialization depth limit), but the inspected public APIs have no total input/output-byte or value-node budget. Shallow large arrays/strings remain outside the depth guard. This is an opt-in resource-control proposal, not a discovered Rust vulnerability.

Starting point: utils/src/wson/mod.rs:20.

Validation

Audited canonical Wave 540728c2eb6cc12f5c69c3fb3fdb96e07ba059a4 (0.0.1-alpha-dev), whose tree matches the local checkout. Validation: Inspected all public WSON parse/write APIs and existing depth guards. Executed compiler probes use the matching checkout-built compiler and std on Linux amd64 (Rust 1.89.0 / LLVM 21.1.8). Source/header or mocked checks are not native execution on another OS.

Scope

Agree caller-selectable byte/node/output budgets that can be used by metadata/diagnostic clients without silently changing existing format or default depth contracts.

Related: #835, #836, #540. These links do not claim those broader or completed scopes are unfinished.

Design discussion required

This issue records a proposal or an unresolved contract; it is not approval to choose new semantics. Please mention @LunaStev to discuss the design before starting implementation.

Completion criteria

  • [ ] Budgeted APIs reject excess shallow input/output with ordinary structured errors.
  • [ ] Within-budget JSON/WSON values and exact numeric/Unicode behavior stay compatible.
  • [ ] Existing depth limits and AST dump-specific limits remain enforced.

LunaStev avatar Oct 24 '26 11:10 LunaStev