Skip to content

Commit e3c01ae

Browse files
committed
fix(app): add source validation to default PostMessageTransport
App.connect() now passes window.parent as both eventTarget and eventSource, enabling source validation by default. This ensures apps only accept messages from their parent window, preventing potential cross-app message spoofing attacks. Previously, the default transport only specified the target but not the source for validation, meaning apps would accept messages from ANY window.
1 parent 7837a8c commit e3c01ae

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/app.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1027,7 +1027,7 @@ export class App extends Protocol<AppRequest, AppNotification, AppResult> {
10271027
* @see {@link PostMessageTransport} for the typical transport implementation
10281028
*/
10291029
override async connect(
1030-
transport: Transport = new PostMessageTransport(window.parent),
1030+
transport: Transport = new PostMessageTransport(window.parent, window.parent),
10311031
options?: RequestOptions,
10321032
): Promise<void> {
10331033
await super.connect(transport);

0 commit comments

Comments
 (0)