Skip to content

fix(webchat): reject spoofed origins without referer - #1602

Merged
realcodesiman merged 4 commits into
mainfrom
skate
Oct 31, 2026
Merged

realcodesiman merged 4 commits into
mainfrom
skate

Conversation

@realcodesiman

@realcodesiman realcodesiman commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Preserve the verified embedding origin through first-party webchat RSC refreshes.
  • Ignore URL-supplied origins for direct and third-party loads, preventing allowlist spoofing when the referer is absent.

Changes

  • Resolve the server token origin from URL parameters only for confirmed first-party refreshes.
  • Read the current URL origin in webchat client message, referral, and realtime paths.
  • Add guest-session, page-guard, and realtime regressions for origin propagation and refererless requests.

Test plan

  • pnpm lint
  • pnpm --filter builder check-types
  • pnpm exec vitest run __tests__/webchat-page-guards.test.tsx --pool=threads --maxWorkers=1
  • pnpm exec vitest run __tests__/webchat-guest-session.test.ts __tests__/webchat-realtime.test.tsx --pool=threads --maxWorkers=1

@github-actions github-actions Bot added the bug Something isn't working as expected label Oct 30, 2026
realcodesiman and others added 2 commits October 31, 2026 07:13
…p action

A no-referrer iframe passed as a direct open and skipped the authorized
domains check; refuse it via Sec-Fetch-Dest when the webchat is restricted.
Also remove the "use server" findIntegrationWebchat wrapper (a publicly
invocable action) and call integrationWebchatService directly.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@realcodesiman
realcodesiman merged commit d0f0c27 into main Oct 31, 2026
14 checks passed
@realcodesiman
realcodesiman deleted the skate branch October 31, 2026 14:52
hello-jackytruong referenced this pull request in hello-jackytruong/ChatWorkAI Nov 22, 2026
* fix(webchat): preserve embedding origin across refreshes

* fix(webchat): reject spoofed origins without referer

* fix(webchat): trust URL origins only after first-party referer

* fix(webchat): refuse referer-less iframe loads and drop exposed lookup action

A no-referrer iframe passed as a direct open and skipped the authorized
domains check; refuse it via Sec-Fetch-Dest when the webchat is restricted.
Also remove the "use server" findIntegrationWebchat wrapper (a publicly
invocable action) and call integrationWebchatService directly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working as expected

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant