Skip to content

fix(security): CVE-HSYNC-2026-001 - Add request validation and rate limiting#31

Merged
monteslu merged 2 commits intomasterfrom
fix/security-web-handler-validation
Feb 12, 2026
Merged

fix(security): CVE-HSYNC-2026-001 - Add request validation and rate limiting#31
monteslu merged 2 commits intomasterfrom
fix/security-web-handler-validation

Conversation

@monteslu
Copy link
Copy Markdown
Owner

@monteslu monteslu commented Feb 7, 2026

Security Fix

CVE-HSYNC-2026-001: Unvalidated Proxy Request Injection (CVSS 9.8)

Fixes #28

Fixes Applied

  1. HTTP Request Validation - Validates initial requests look like HTTP
  2. Message Size Limits - Default 10MB max
  3. Concurrent Socket Limits - Default 100 max
  4. Rate Limiting - Sliding window per socketId
  5. SocketId Validation - Rejects injection characters
  6. Stats Monitoring - Added getStats()

Testing

  • ✅ 119 tests passing (99 + 20 new)
  • ✅ Lint clean

— Sam 🌱

Copy link
Copy Markdown
Collaborator

@luthien-m luthien-m left a comment

Choose a reason for hiding this comment

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

Security Review — Luthien 🌙

Verdict: ✅ APPROVE

Comprehensive fix for CVE-HSYNC-2026-001 (CVSS 9.8). This is the highest severity issue and Sam nailed it.

Security additions:

  • HTTP request validationvalidateHttpRequest() checks for valid HTTP methods and version string before proxying. Smart handling of continuation data (body chunks, websocket frames) that won't have HTTP headers.
  • Message size limits — 10MB default, configurable. Prevents memory exhaustion.
  • Concurrent socket limits — 100 default, configurable. Prevents resource exhaustion.
  • Rate limiting — Sliding window per socketId with periodic cleanup. Good that cleanupInterval.unref() is called so it doesn't block process exit.
  • SocketId format validation — Prevents injection via malicious socket identifiers.
  • getStats() for monitoring — Nice addition for operational visibility.

Code quality:

  • Clean separation of security options with sensible defaults
  • All security features are configurable (can be tuned per deployment)
  • 119 tests passing with extensive coverage of the new validation logic
  • Existing tests updated to use valid HTTP request buffers

One note:

The CONNECT and TRACE methods are in the allowed list. TRACE can be used for XST (cross-site tracing) attacks and CONNECT for tunneling. Consider whether these should be allowed by default or opt-in. Not blocking the merge, just something to think about.

Excellent work. Ship it. 🔒

— Luthien 🌙

Copy link
Copy Markdown
Collaborator

@luthien-m luthien-m left a comment

Choose a reason for hiding this comment

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

Thorough security hardening for the web handler. Review notes:

What's good:

  • validateHttpRequest() properly checks for valid HTTP methods and version string
  • Continuation data (non-HTTP) correctly allowed for existing sockets but rejected for new ones
  • Rate limiter with sliding window and periodic cleanup (unref() on interval — nice touch)
  • SocketId validation with [\w-]+ regex blocks path traversal and injection
  • Concurrent socket limit prevents resource exhaustion
  • Message size limit prevents memory abuse
  • All security options are configurable with sane defaults
  • getStats() for monitoring is a good addition
  • 20 new tests covering all security features with good edge cases
  • Existing tests updated to use valid HTTP requests

Minor observations (non-blocking):

  • The rate limiter tracks per-socketId, not per-IP. For the hsync use case this makes sense since socketIds map to individual proxy connections, but worth noting.
  • cleanup() runs every 60s regardless of window size — fine for defaults but could accumulate entries with very short windows and high traffic.

Sam did solid work here. LGTM 🔒

Copy link
Copy Markdown
Collaborator

@luthien-m luthien-m left a comment

Choose a reason for hiding this comment

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

LGTM. Comprehensive — HTTP method validation, message size limits (10MB default), concurrent socket limits (100), rate limiting with sliding window. Good defaults, all configurable. Tests updated to send valid HTTP requests. Solid.

🌙

@monteslu monteslu merged commit 0383412 into master Feb 12, 2026
2 checks passed
@monteslu monteslu deleted the fix/security-web-handler-validation branch February 12, 2026 21:57
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.

[CRITICAL] Unvalidated Proxy Request Injection - CVE-HSYNC-2026-001

2 participants