Skip to content

fix: reject oversized envelopes at decode (#72) - #76

Open
chtnnh wants to merge 3 commits into
ni5arga:mainfrom
chtnnh:fix/72-decode-envelope-size-cap
Open

fix: reject oversized envelopes at decode (#72)#76
chtnnh wants to merge 3 commits into
ni5arga:mainfrom
chtnnh:fix/72-decode-envelope-size-cap

Conversation

@chtnnh

@chtnnh chtnnh commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Summary

  • decodeEnvelope rejects payloadLen > MAX_ENVELOPE_LEN - HEADER_LEN (same bound as encode).
  • storeEnvelope (SQL + memory) catches encode failures instead of throwing.
  • Mesh payload handler .catch()s ingest so residual failures cannot surface as unhandled rejections.

Closes #72

Test plan

  • npm test / npm run typecheck (oversized decode + storeEnvelope swallow)
  • Optional: hand-craft ~30 001-byte frame under native 32 KiB cap; confirm quiet drop

chtnnh and others added 3 commits July 23, 2026 12:52
Mirror encodeEnvelope's payload ceiling in decodeEnvelope so hostile
frames under the native 32 KiB reassembly cap cannot trial-decrypt then
throw in storeEnvelope. Swallow encode failures in store and catch ingest.

Co-authored-by: Cursor <cursoragent@cursor.com>
CI's `npx expo install --check` started failing after upstream SDK 57
patch bumps (expo ~57.0.8 and related packages).

Co-authored-by: Cursor <cursoragent@cursor.com>
Lock @napi-rs/wasm-runtime's @emnapi/core and @emnapi/runtime peers at
the top level so CI's npm ci does not demand an unlocked 1.11.2.

Co-authored-by: Cursor <cursoragent@cursor.com>
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.

[Medium] decodeEnvelope has no payload size ceiling, oversized envelope crashes storeEnvelope as an unhandled rejection

1 participant