Skip to content

fix: wildcard server sends interactions to all clients#1339

Merged
dogancanbakir merged 1 commit intodevfrom
fix/wildcard-multi-client-poll
Mar 5, 2026
Merged

fix: wildcard server sends interactions to all clients#1339
dogancanbakir merged 1 commit intodevfrom
fix/wildcard-multi-client-poll

Conversation

@dogancanbakir
Copy link
Copy Markdown
Member

Summary

  • In wildcard mode (-wc), GetInteractionsWithId clears data on the first client's poll, starving all other clients
  • Add per-consumer read offsets (GetInteractionsWithIdForConsumer) so each client independently tracks its position in the shared data buffer
  • Clean up consumer offsets on deregister, evict stale consumers lazily, enforce configurable max buffer cap (INTERACTSH_MAX_SHARED_INTERACTIONS, default 10000)

Fixes #1296

In wildcard mode, GetInteractionsWithId clears data on first poll,
starving subsequent clients. Use per-consumer read offsets so each
client independently tracks its position in the shared data buffer.

Buffer cap is configurable via INTERACTSH_MAX_SHARED_INTERACTIONS
env var (default 10000).
@neo-by-projectdiscovery-dev
Copy link
Copy Markdown

neo-by-projectdiscovery-dev Bot commented Feb 25, 2026

Neo - PR Security Review

No security issues found

Highlights

  • Implements per-consumer read offsets for wildcard mode to fix multi-client polling starvation
  • Adds buffer cap enforcement (INTERACTSH_MAX_SHARED_INTERACTIONS, default 10000) to prevent unbounded memory growth
  • Includes consumer cleanup on deregister and stale consumer eviction based on EvictionTTL
Hardening Notes
  • Consider adding rate limiting on the /poll endpoint to prevent abuse from authenticated clients making excessive polling requests
  • Add logging/metrics for buffer cap enforcement events in enforceMaxBuffer (storagedb.go:367) to monitor when the limit is reached and data is being trimmed
  • Consider adding a configurable maximum number of concurrent consumers per wildcard ID to prevent resource exhaustion from a single attacker registering many clients

Comment @neo help for available commands. · Open in Neo

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 25, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/wildcard-multi-client-poll

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Member

@Mzack9999 Mzack9999 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - This was an original design choice as the instance was supposed to be single authenticated user with the capability to obtain full interactions without per-user tracking. This also handled the case of instance reconnection with a potential different correlationId.

@dogancanbakir dogancanbakir merged commit fe9869d into dev Mar 5, 2026
10 checks passed
@dogancanbakir dogancanbakir deleted the fix/wildcard-multi-client-poll branch March 5, 2026 13:44
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.

Wildcard server only sends interactions to one connected client, instead of all of them

2 participants