Skip to content

Commit 5e98158

Browse files
committed
feat(patches): add parent-origin bypass
1 parent 202630d commit 5e98158

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

patches/parent-origin.diff

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
Remove parentOriginHash checko
2+
3+
This fixes webviews from not working properly due to a change upstream.
4+
Upstream added a check to ensure parent authority is encoded into the webview
5+
origin. Since our webview origin is the parent authority, we can bypass this
6+
check.
7+
8+
Index: code-server/lib/vscode/src/vs/workbench/contrib/webview/browser/pre/main.js
9+
===================================================================
10+
--- code-server.orig/lib/vscode/src/vs/workbench/contrib/webview/browser/pre/main.js
11+
+++ code-server/lib/vscode/src/vs/workbench/contrib/webview/browser/pre/main.js
12+
@@ -339,12 +339,7 @@ const hostMessaging = new class HostMess
13+
throw err instanceof Error ? err : new Error(String(err));
14+
}
15+
16+
- if (hostname === parentOriginHash || hostname.startsWith(parentOriginHash + '.')) {
17+
- // validation succeeded!
18+
- return start(parentOrigin);
19+
- }
20+
-
21+
- throw new Error(`Expected '${parentOriginHash}' as hostname or subdomain!`);
22+
+ return start(parentOrigin);
23+
}
24+
}();
25+

patches/series

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ service-worker.diff
1818
connection-type.diff
1919
sourcemaps.diff
2020
disable-downloads.diff
21+
parent-origin.diff

0 commit comments

Comments
 (0)