Merged
Conversation
ec4593a to
a06b7d5
Compare
- Enforce retry floor (min 1000ms) to prevent reconnection storm DoS - Sanitize Last-Event-ID header by stripping control characters (\x00-\x1f) - Add maxSessions per-subscription connection limit with 503 rejection - Add maxDuration connection TTL with ±10% jitter to prevent thundering herd - Add 29 security tests covering CRLF injection, retry abuse, cross-client isolation, connection exhaustion, and post-stop safety - Document new options and security properties in API.md
damusix
approved these changes
Apr 7, 2026
Surface mistakes in configuration up-front (at register, subscription declaration, route build, and replayer construction) instead of letting them fail silently or surface deep inside request handling. - Plugin options validated against a labeled Joi schema at register() covering keepAlive, retry, headers, hooks, and backpressure. - subscription() asserts the path via Hoek.assert (non-empty, starts with "/") and validates SubscriptionConfig — filter/onSubscribe/ onUnsubscribe/onReconnect, retry, keepAlive, replay (duck-typed Replayer), maxSessions, maxDuration. - The sse handler decoration validates SseHandlerOptions once when the route builds the handler, embedding "METHOD path" in the error so the failing route is obvious. - FiniteReplayer and ValidReplayer constructors validate their own option objects. Hot paths (publish, broadcast, eachSession, Session.push) are deliberately untouched — validation only runs at configuration boundaries that are exercised once per server lifecycle. Adds joi and @hapi/hoek as direct dependencies.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Here is a 1st pass review for the initial implementation.
Coverage & Testing
Build & CI