Skip to content

attention: validate config and input lengths; catch panics at NAPI boundary (+ graph storage decode limit) - #1365

Merged
ruvnet merged 5 commits into
mainfrom
fix/security-hardening-2026-11-05
Nov 6, 2026
Merged

ruvnet merged 5 commits into
mainfrom
fix/security-hardening-2026-11-05

Conversation

@ruvnet

@ruvnet ruvnet commented Nov 5, 2026

Copy link
Copy Markdown
Owner

Summary

@ruvector/attention / ruvector-attention

  • Validate attention configuration (dims, head counts, block size, feature/expert counts, RoPE positions, finite numeric params, allocation sizes) and query/key/value/edge lengths at the NAPI boundary; invalid input now throws a JS Error.
  • Mark every synchronous binding #[napi(catch_unwind)] so a remaining Rust panic is rethrown as a JS Error.
  • Core crate: length checks in MultiHeadAttention::compute, FlashAttention::compute (block size, ragged values), EdgeFeaturedAttention::compute_with_edges, GraphRoPE::compute_with_positions, and mask length checks in compute_with_mask. Adds non-breaking try_new / validate / try_apply_rotary helpers.

ruvector-graph / @ruvector/graph-node

  • Decode stored records with a 64 MiB bincode limit.
  • Regression tests for deep Cypher nesting (Rust parser + query()/querySync() in the Node package).

Versions

  • ruvector-attention 2.3.1, ruvector-attention-node 2.3.1, @ruvector/attention 2.2.3
  • ruvector-graph 2.3.4, @ruvector/graph-node 2.1.2

Tests

  • cargo test -p ruvector-attention -p ruvector-graph (all green, new unit tests in multi_head/flash/edge_featured/rope/storage/parser)
  • node --test crates/ruvector-attention-node/test/ and node --test npm/packages/graph-node/test/ against local builds
  • cargo +1.98.1 clippy -p ruvector-attention -p ruvector-attention-node -p ruvector-graph --all-targets --no-deps -- -D warnings, cargo fmt --all --check, cargo deny check

🤖 Generated with claude-flow

…I boundary

ruvector-attention:
- MultiHeadAttention::compute checks key/value counts and lengths; add
  MultiHeadAttention::try_new.
- FlashAttention::compute rejects block_size 0 and ragged values.
- EdgeFeaturedConfig::validate / EdgeFeaturedAttention::try_new; head_dim no
  longer divides by zero; compute_with_edges checks node, value and edge widths.
- RoPEConfig::validate / GraphRoPE::try_new / try_apply_rotary; compute checks
  key lengths; apply_rotary and distance_to_position no longer underflow.
- compute_with_mask in every mechanism rejects a mask whose length differs
  from the key count.

ruvector-attention-node (@ruvector/attention):
- New validate module: dims, counts, allocation sizes, finite numbers and
  query/key/value lengths are checked before calling into Rust and rejected
  with a JS Error.
- Every sync binding is #[napi(catch_unwind)], so a remaining panic surfaces
  as a JS Error instead of aborting the process.
- test/input-validation.test.js covers each case (node --test).

Versions: ruvector-attention 2.3.1, ruvector-attention-node 2.3.1,
@ruvector/attention 2.2.3.

Co-Authored-By: claude-flow <ruv@ruv.net>
…node 2.1.2

- storage: decode nodes, edges and hyperedges with a 64 MiB bincode limit so a
  corrupt length prefix in a database file returns an error instead of a huge
  allocation.
- cypher parser: regression test for 5k nested parentheses and a 200k NOT
  chain (both return a nesting error).
- @ruvector/graph-node: test/cypher-nesting.test.js checks query()/querySync()
  reject the same inputs; bump to 2.1.2 to ship the current parser.
- ruvector-graph 2.3.4.

Co-Authored-By: claude-flow <ruv@ruv.net>
Defaults to true, so tag pushes and existing dispatches behave as before.

Co-Authored-By: claude-flow <ruv@ruv.net>
GitHub now rejects the macos-14 configuration ('macos-14-arm64-us-default' is
not supported), which cancels every darwin build job. macos-15 is arm64 like
macos-14, so the x86_64-apple-darwin targets keep cross-compiling as before.

Co-Authored-By: claude-flow <ruv@ruv.net>
…n is rejected)

Co-Authored-By: claude-flow <ruv@ruv.net>
@ruvnet
ruvnet merged commit bc999ee into main Nov 6, 2026
75 of 76 checks passed
@ruvnet
ruvnet deleted the fix/security-hardening-2026-11-05 branch November 6, 2026 05:17
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