Skip to content

fix: bound simple API span storage - #57

Open
mcollina wants to merge 2 commits into
ShogunPanda:mainfrom
mcollina:security/sec-17-simple-span-drain
Open

mcollina wants to merge 2 commits into
ShogunPanda:mainfrom
mcollina:security/sec-17-simple-span-drain

Conversation

@mcollina

Copy link
Copy Markdown
Contributor

Bound span retention in the JavaScript simple() API and add explicit draining.

simple({ maxSpans = 65536 }) now validates a non-negative safe-integer per-parser cap. Once a parser reaches the cap, generated callbacks stop appending and set spanOverflow[parser]. drain(parser) returns { spans, truncated } and resets that parser's collection, while destroy(parser) removes both span and overflow entries.

The callback placeholder is also emitted on its own protected template line so the postbuild generator installs every simple callback in ESM/CJS and SIMD/non-SIMD packages.

The new WASM regression covers invalid options, cap enforcement, truncation reporting, repeated drains and parser reuse, and destroy cleanup. Both WASM variants, all 99 JavaScript tests, and the WASM references pass.

This fixes SEC-17 from #38.

This branch has not been deployed

No deployments
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