From 5e98158c8bc70df7e84f6282b3ea17aa8c91c649 Mon Sep 17 00:00:00 2001 From: Joe Previte Date: Wed, 27 Apr 2022 16:09:46 -0700 Subject: [PATCH] feat(patches): add parent-origin bypass --- patches/parent-origin.diff | 25 +++++++++++++++++++++++++ patches/series | 1 + 2 files changed, 26 insertions(+) create mode 100644 patches/parent-origin.diff diff --git a/patches/parent-origin.diff b/patches/parent-origin.diff new file mode 100644 index 000000000..c28e8b8c3 --- /dev/null +++ b/patches/parent-origin.diff @@ -0,0 +1,25 @@ +Remove parentOriginHash checko + +This fixes webviews from not working properly due to a change upstream. +Upstream added a check to ensure parent authority is encoded into the webview +origin. Since our webview origin is the parent authority, we can bypass this +check. + +Index: code-server/lib/vscode/src/vs/workbench/contrib/webview/browser/pre/main.js +=================================================================== +--- code-server.orig/lib/vscode/src/vs/workbench/contrib/webview/browser/pre/main.js ++++ code-server/lib/vscode/src/vs/workbench/contrib/webview/browser/pre/main.js +@@ -339,12 +339,7 @@ const hostMessaging = new class HostMess + throw err instanceof Error ? err : new Error(String(err)); + } + +- if (hostname === parentOriginHash || hostname.startsWith(parentOriginHash + '.')) { +- // validation succeeded! +- return start(parentOrigin); +- } +- +- throw new Error(`Expected '${parentOriginHash}' as hostname or subdomain!`); ++ return start(parentOrigin); + } + }(); + diff --git a/patches/series b/patches/series index f7a44e236..2216e27a4 100644 --- a/patches/series +++ b/patches/series @@ -18,3 +18,4 @@ service-worker.diff connection-type.diff sourcemaps.diff disable-downloads.diff +parent-origin.diff