Skip to content

fix: only accept delegated tokens from the embedding host - #4297

Merged
AlexAndBear merged 1 commit into
mainfrom
fix/embed-token-message-source
Nov 5, 2026
Merged

AlexAndBear merged 1 commit into
mainfrom
fix/embed-token-message-source

Conversation

@AlexAndBear

@AlexAndBear AlexAndBear commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

Description

In embed mode with delegated authentication, Web took the access token from any window that posted the token message, as long as no origin was configured, so another page could make the embedded Web run with a different account. Tokens are now only accepted from the direct parent window, the same kind of sender check #4289 added to the pickers.

Possibly breaking for integrations: a token posted by a window other than the direct parent (a grandparent frame, a relay frame, a popup opener, or the same window in a webview) is now ignored. The documented flow, where the embedding page answers with iframe.contentWindow.postMessage, keeps working. Docs: opencloud-eu/docs#1303.

Related Issue

How Has This Been Tested?

  • test environment: unit tests (Vitest), browser tests (Playwright) against a local OpenCloud
  • test case 1: unit: both token handlers ignore a token from another window, without a source or when Web isn't embedded, and accept it from the parent; the existing origin check still applies
  • test case 2: browser: embedded Web with delegated auth and no origin configured, another page posting a second account's token into the frame: on main all API requests switched to that account, now Web stays on the host's account
  • test case 3: browser: the host's initial token, a later token update from the host and the configured origin option still work

Types of changes

  • Bugfix
  • Enhancement (a change that doesn't break existing code or deployments)
  • Breaking change (a modification that affects current functionality)
  • Technical debt (addressing code that needs refactoring or improvements)
  • Tests (adding or improving tests)
  • Documentation (updates or additions to documentation)
  • Maintenance (like dependency updates or tooling adjustments)

@JammingBen JammingBen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@AlexAndBear
AlexAndBear merged commit da928c7 into main Nov 5, 2026
30 checks passed
@AlexAndBear
AlexAndBear deleted the fix/embed-token-message-source branch November 5, 2026 10:14
@openclouders openclouders mentioned this pull request Nov 5, 2026
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Embed mode accepts delegated tokens from windows other than the host

2 participants