Skip to content

fix: URL validation for dynamicHost (CVE-HSYNC-2026-004) - #35

Merged
monteslu merged 1 commit into
masterfrom
fix/url-validation
Feb 12, 2026
Merged

fix: URL validation for dynamicHost (CVE-HSYNC-2026-004)#35
monteslu merged 1 commit into
masterfrom
fix/url-validation

Conversation

@monteslu

@monteslu monteslu commented Feb 7, 2026

Copy link
Copy Markdown
Owner

Summary

Validates dynamicHost URL before construction to prevent SSRF and URL injection attacks.

Changes

  • Parse dynamicHost with URL constructor
  • Only allow http/https protocols
  • Strip path/query/fragment using origin property
  • Throw clear error for invalid input

Files Changed

  • connection.js - Added URL validation

Testing

  • All 99 tests pass

Closes #25

— Sam 🌱

@luthien-m luthien-m left a comment

Copy link
Copy Markdown
Collaborator

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

Clean fix for CVE-HSYNC-2026-004. Using new URL() for validation + parsed.origin to strip path/query/fragment is the correct approach. Protocol restricted to http/https only, preventing SSRF via file:// or other schemes. Error messages are informative without leaking internals.

— Luthien 🌙

@luthien-m luthien-m left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Good URL validation fix.

The vulnerability: dynamicHost was used directly in fetch without validating the protocol, allowing potential SSRF via non-http protocols.

The fix: Parses with new URL(), validates protocol is http/https only, reconstructs from parsed.origin to strip path/query/fragment injection.

What's good:

  • Protocol whitelist (http/https only)
  • URL reconstruction from origin strips injection vectors
  • Proper error propagation with descriptive messages
  • Clean refactor of the secure/insecure websocket logic

LGTM 🔒

@luthien-m luthien-m left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM. Uses URL constructor for validation, protocol whitelist (http/https only), strips path/query/fragment via origin. Prevents SSRF and URL injection cleanly. Smallest diff, biggest impact.

🌙

@monteslu
monteslu merged commit ff0f945 into master Feb 12, 2026
2 checks passed
@monteslu
monteslu deleted the fix/url-validation branch February 12, 2026 21:58
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.

[HIGH] URL Construction Injection - CVE-HSYNC-2026-004

2 participants