Skip to content

fix(http): require Origin header on WebSocket upgrades (SEC-88)#208

Open
aris1009 wants to merge 1 commit into
mainfrom
fix/sec-88-require-origin-on-ws-upgrades
Open

fix(http): require Origin header on WebSocket upgrades (SEC-88)#208
aris1009 wants to merge 1 commit into
mainfrom
fix/sec-88-require-origin-on-ws-upgrades

Conversation

@aris1009
Copy link
Copy Markdown
Member

Summary

  • Reject WS upgrades that arrive without an Origin header. Browsers always send it on WS upgrades (RFC 6455 §10.2); a missing value is either a non-browser client or a forged upgrade.
  • ensureOrigin is only mounted on wsRouter.ws handlers, so HTTP API clients are unaffected.

Test plan

  • Existing parameterised authenticateOrigin table updated; new case asserts missing Origin throws even when the host header is valid.
  • jest test/unit/node/http.test.ts — 53 passed, 0 failed.
  • Smoke-test in dev: confirm the iframe still establishes WS to terminal/file-sync after deploy.

Closes SEC-88.

@lookout-on-dev
Copy link
Copy Markdown

No breaking data contract changes detected in this PR.

The changes are limited to WebSocket Origin-header enforcement (src/node/http.ts) and its unit tests — neither file touches any analytics tracking calls. The sole tracking event (ide.session_started) and its properties in src/node/rudderstack.ts are unaffected.

🔒 Scanned for secrets using gitleaks 8.30.1
@aris1009 aris1009 force-pushed the fix/sec-88-require-origin-on-ws-upgrades branch from 34dc89b to c71e5e0 Compare May 12, 2026 08:40
@aris1009 aris1009 changed the title fix(sec-88): require Origin header on WebSocket upgrades fix(http): require Origin header on WebSocket upgrades (SEC-88) May 12, 2026
@lookout-on-dev
Copy link
Copy Markdown

No breaking data contract changes detected in this PR.

This change is a server-side security fix (authenticateOrigin now rejects WebSocket upgrades that lack an Origin header) and has no effect on analytics event names, properties, or types sent to any RudderStack destination.

@aris1009 aris1009 requested a review from debanjan97 May 12, 2026 08:41
@github-actions
Copy link
Copy Markdown
Contributor

Docker Preview Images Ready

Preview Docker images have been built for this PR:

ECR (internal):

docker pull 422074288268.dkr.ecr.us-east-1.amazonaws.com/rudderstack/profiles-code-server:pr-208

Image Details:

  • Tag: pr-208
  • Platforms: linux/amd64, linux/arm64

Test the image:

docker run --rm -p 8080:8080 422074288268.dkr.ecr.us-east-1.amazonaws.com/rudderstack/profiles-code-server:pr-208

Note: These preview images will be overwritten on subsequent pushes to this PR.

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.

1 participant