Skip to content

fix(client): cap voice.participants + gate unknown channels (SEC-V-03)#467

Merged
intendednull merged 1 commit into
mainfrom
auto-fix/issue-303-voice-cap
Apr 28, 2026
Merged

fix(client): cap voice.participants + gate unknown channels (SEC-V-03)#467
intendednull merged 1 commit into
mainfrom
auto-fix/issue-303-voice-cap

Conversation

@intendednull
Copy link
Copy Markdown
Owner

what

Drop VoiceJoin/Leave/Signal whose channel_id no in ServerState.channels. Cap distinct channels + per-channel participants in VoiceState. Stop signed peer flood arbitrary channel_id strings until receiving clients exhaust memory.

caps

  • MAX_VOICE_CHANNELS = 256 — outer dim of participants
  • MAX_PARTICIPANTS_PER_CHANNEL = 256 — inner dim

Defensive ceiling, no expected operating point. Real servers run single-digit voice channels.

where

crates/client/src/listeners.rsprocess_received_message Voice* arms. Channel-existence check read ctx.event_state (actor mirror materialized ServerState). Cap check inside voice mutate so size check + insert atomic.

tradeoffs

Runner-up: cap inside VoiceState type itself. Rejected — listener already at trust boundary, own existence-vs-cap policy. Pushing into VoiceState need pass ServerState snapshot into actor or dup state read. Both worse than two short selects in listener.

tests (client tier)

  • voice_join_with_unknown_channel_is_dropped
  • voice_join_with_known_channel_records_participant (sanity)
  • voice_join_rejects_when_distinct_channels_at_cap
  • voice_join_rejects_when_participants_at_cap
  • voice_leave_with_unknown_channel_is_dropped

State-tier rejected: VoiceState live in client crate not state. Bug in listener wire, not pure state logic.

verify

  • cargo fmt --check clean
  • cargo clippy --workspace --all-targets -- -D warnings clean
  • cargo test -p willow-client → 292 passed
  • cargo check -p willow-client --target wasm32-unknown-unknown clean

Closes #303

https://claude.ai/code/session_014KLEYzesqZwWdFQnUeXtrJ


Generated by Claude Code

…-03)

Drop VoiceJoin/Leave/Signal whose `channel_id` is not in
`ServerState.channels`. Cap distinct channels and per-channel
participants in `VoiceState`. Without these gates any signed peer can
flood `WireMessage::VoiceJoin { channel_id, peer_id }` with arbitrary
strings until receiving clients exhaust memory.

## Caps

- `MAX_VOICE_CHANNELS = 256` — outer dimension of `participants`.
- `MAX_PARTICIPANTS_PER_CHANNEL = 256` — inner dimension.

Caps are defensive ceilings, not expected operating points; real
servers run with single-digit voice channels.

## Where

`crates/client/src/listeners.rs` — `process_received_message` Voice*
arms. Channel-existence check reads `ctx.event_state` (the actor that
mirrors materialized `ServerState`); cap check runs inside the voice
mutate to keep insert atomic with the size check.

## Tradeoffs

Runner-up: cap inside `VoiceState` itself (e.g. wrap `participants`
in a capped type). Rejected — the listener already sits at the trust
boundary and owns the existence-vs-cap policy. Pushing into
`VoiceState` would either need passing `ServerState` snapshots into
the actor or duplicating the state read; both worse than two short
selects in the listener.

## Tests (client tier — `crates/client/src/listeners.rs` test mod)

- `voice_join_with_unknown_channel_is_dropped`
- `voice_join_with_known_channel_records_participant` (sanity)
- `voice_join_rejects_when_distinct_channels_at_cap`
- `voice_join_rejects_when_participants_at_cap`
- `voice_leave_with_unknown_channel_is_dropped`

State-machine tier rejected: `VoiceState` lives in the client crate,
not state. Bug is in listener wiring, not pure state logic.

## Verification

Local (sub-PR base = main, CI fires on push):
- `cargo fmt --check` clean
- `cargo clippy --workspace --all-targets -- -D warnings` clean
- `cargo test -p willow-client` 292 passed
- `cargo check -p willow-client --target wasm32-unknown-unknown` clean

Closes #303

https://claude.ai/code/session_014KLEYzesqZwWdFQnUeXtrJ
@intendednull intendednull merged commit 33f6863 into main Apr 28, 2026
7 checks passed
@intendednull intendednull deleted the auto-fix/issue-303-voice-cap branch April 28, 2026 22:51
intendednull pushed a commit that referenced this pull request Apr 28, 2026
…gates

PR #467 (SEC-V-03 voice cap, issue #303) merged into main while this
batch was open. It modified the same Voice* listener arms that #253
migrated to warn_if_err. Both changes are independent and compose:

- Keep all SEC-V-03 logic from origin/main (drop unknown-channel
  VoiceJoin/Leave/Signal, cap participants at MAX_VOICE_CHANNELS /
  MAX_PARTICIPANTS_PER_CHANNEL).
- Wrap the final event_broker.do_send(Publish(...)) calls in
  warn_if_err per #253.

cargo check -p willow-client --tests + cargo test -p willow-client
both clean (310 passed).
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.

[SEC-V-03] Unbounded growth of voice.participants from attacker-controlled channel_id

2 participants