You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
kind:securitySecurity impact; report a vulnerability to [email protected], not herekind:testTest coverage, flakes, fixtures or the e2e harnessprio:highNext uprustDependabot: a Cargo update; use area: labels for Rust code otherwise
PR #659 ships the validation-side cap for #577 M3 (MAX_TRAILING_BYTES = 4 KiB + oversize_trailing_bytes rejection metric). That's detection-only: by the time `validate_envelope` runs, iroh-gossip has already allocated the full padded message (~up to its per-message ceiling, currently 16 MiB) and pushed it into our subscriber loop as `msg.content: Bytes`.
The deeper fix — bound the upstream allocation so it never happens — needs a size knob on the gossip subscribe path. Two options worth investigating:
Patch iroh-gossip to accept a per-subscription max-message-size, or expose its existing internal cap as a tunable. (Upstream change.)
Wire a Rust-side framing checkbefore iroh-gossip allocates, if their layering allows. Probably requires a fork or PR upstream.
Context links:
PR #659 — validation-side cap (this issue's prerequisite)
ADR 013 §Wire Framing notes: "Operators on memory-constrained nodes SHOULD set a lower `MAX_MESSAGE_SIZE` as local policy." That aspiration becomes a real implementation task here.
Gossip subscriber's per-message allocation is bounded to a deCDN-controlled value (proposal: same 4 KiB scale as `MAX_TRAILING_BYTES`, or maybe 16 KiB to leave headroom for legitimate envelope growth past the trailing-bytes cap).
New ADR or amendment to ADR 013 documents the per-ALPN policy and any iroh-gossip version dependency.
Regression test (likely needs a custom iroh-gossip fixture) that an oversized inbound gossip message is rejected at the framing layer, not at envelope validation.
This is a well-scoped security hardening task that follows up on PR #659's detection-only envelope cap. The core problem: iroh-gossip allocates up to its internal 16 MiB ceiling beforevalidate_envelope can reject an oversized message, meaning a malicious peer can force large heap allocations. The fix requires either an upstream iroh-gossip API change to expose a per-subscription size knob, or a pre-allocation framing intercept (likely via fork/PR upstream).
📊 Assessment
Dimension
Value
Reasoning
Type
Task
Follow-up hardening work with clear prerequisites and defined acceptance criteria
Memory exhaustion via malicious peer is a real DoS vector; regression test is an explicit acceptance criterion
Coding agent
Needs more info
The two implementation paths (upstream iroh-gossip PR vs. fork/intercept) represent a design decision that needs resolution before code can be written confidently
🔗 Similar issues
No distinct duplicate issues found — searches returned only this issue. Related context is in PR #659 and issue #577.
💡 Notes and suggestions
Implementation decision needed first: The issue offers two paths; maintainers should pick one before assigning to a coding agent:
Option A — upstream PR: File an iroh-gossip issue/PR to add subscribe_with_max_size(topic, peers, max_bytes: usize). Cleanest long-term; may be slow to merge.
Option B — local wrapper/fork: Add a size-check shim in crates/gossip/src/service.rs around the msg.content bytes immediately after receipt but before passing to the envelope validator. This doesn't prevent allocation but bounds it at the deCDN layer; a fork could intercept earlier.
Candidate size values:
The issue proposes 4 KiB (same as MAX_TRAILING_BYTES) or 16 KiB with headroom. Given NodeAnnounce gossip messages are tiny (public key + addr + metadata), 4–8 KiB is defensible; 16 KiB aligns with ADR 013's existing language.
Sub-task checklist:
Investigate iroh-gossip 0.98 API surface for any existing size cap knob
Decide: upstream PR vs. local wrapper vs. fork
Implement chosen approach in crates/gossip/src/service.rs
Add/amend ADR 013 with per-ALPN ceiling policy and iroh-gossip version dependency
Write regression test with custom iroh-gossip fixture for the framing-layer rejection
Key file:crates/gossip/src/service.rs — gossip.subscribe(topic_id, Vec::new()) call site
kind:securitySecurity impact; report a vulnerability to [email protected], not herekind:testTest coverage, flakes, fixtures or the e2e harnessprio:highNext uprustDependabot: a Cargo update; use area: labels for Rust code otherwise
Activity
github-actions commentedon May 21, 2026
🎯 Triage report
This is a well-scoped security hardening task that follows up on PR #659's detection-only envelope cap. The core problem: iroh-gossip allocates up to its internal 16 MiB ceiling before
validate_envelopecan reject an oversized message, meaning a malicious peer can force large heap allocations. The fix requires either an upstream iroh-gossip API change to expose a per-subscription size knob, or a pre-allocation framing intercept (likely via fork/PR upstream).📊 Assessment
high,testingadded (existing:security,technical,rust)🔗 Similar issues
No distinct duplicate issues found — searches returned only this issue. Related context is in PR #659 and issue #577.
💡 Notes and suggestions
Implementation decision needed first: The issue offers two paths; maintainers should pick one before assigning to a coding agent:
subscribe_with_max_size(topic, peers, max_bytes: usize). Cleanest long-term; may be slow to merge.crates/gossip/src/service.rsaround themsg.contentbytes immediately after receipt but before passing to the envelope validator. This doesn't prevent allocation but bounds it at the deCDN layer; a fork could intercept earlier.Candidate size values:
MAX_TRAILING_BYTES) or 16 KiB with headroom. Given NodeAnnounce gossip messages are tiny (public key + addr + metadata), 4–8 KiB is defensible; 16 KiB aligns with ADR 013's existing language.Sub-task checklist:
crates/gossip/src/service.rsKey file:
crates/gossip/src/service.rs—gossip.subscribe(topic_id, Vec::new())call sitefix(577): trailing-byte padding cap (M3) + probe I/O classification (…
fix(gossip): pin iroh-gossip frame ceiling to GOSSIP_MAX_FRAME (#660) (…