Skip to content

Commit f0636d0

Browse files
Merge branch 'main' into jsjoeio/5366
2 parents e6e85d2 + 2bfe15b commit f0636d0

20 files changed

+261
-255
lines changed

lib/vscode

Submodule vscode updated 2272 files

patches/base-path.diff

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Index: code-server/lib/vscode/src/vs/base/common/network.ts
1010
===================================================================
1111
--- code-server.orig/lib/vscode/src/vs/base/common/network.ts
1212
+++ code-server/lib/vscode/src/vs/base/common/network.ts
13-
@@ -157,7 +157,9 @@ class RemoteAuthoritiesImpl {
13+
@@ -162,7 +162,9 @@ class RemoteAuthoritiesImpl {
1414
return URI.from({
1515
scheme: platform.isWeb ? this._preferredWebSchema : Schemas.vscodeRemoteResource,
1616
authority: `${host}:${port}`,
@@ -118,26 +118,25 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
118118
===================================================================
119119
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
120120
+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
121-
@@ -267,14 +267,10 @@ export class WebClientServer {
121+
@@ -267,12 +267,11 @@ export class WebClientServer {
122122
return res.end();
123123
}
124124

125-
- let originalHost = req.headers['x-original-host'];
126-
- if (Array.isArray(originalHost)) {
127-
- originalHost = originalHost[0];
128-
- }
129-
- const remoteAuthority = originalHost || req.headers.host;
130-
- if (!remoteAuthority) {
131-
- return serveError(req, res, 400, `Bad request.`);
132-
- }
133-
+ // It is not possible to reliably detect the remote authority on the server
134-
+ // in all cases. Set this to something invalid to make sure we catch code
135-
+ // that is using this when it should not.
125+
- const getFirstHeader = (headerName: string) => {
126+
- const val = req.headers[headerName];
127+
- return Array.isArray(val) ? val[0] : val;
128+
- };
129+
-
130+
- const remoteAuthority = getFirstHeader('x-original-host') || getFirstHeader('x-forwarded-host') || req.headers.host;
131+
+ // For now we are getting the remote authority from the client to avoid
132+
+ // needing specific configuration for reverse proxies to work. Set this to
133+
+ // something invalid to make sure we catch code that is using this value
134+
+ // from the backend when it should not.
136135
+ const remoteAuthority = 'remote';
137-
138-
function asJSON(value: unknown): string {
139-
return JSON.stringify(value).replace(/"/g, '"');
140-
@@ -297,6 +293,8 @@ export class WebClientServer {
136+
if (!remoteAuthority) {
137+
return serveError(req, res, 400, `Bad request.`);
138+
}
139+
@@ -298,6 +297,8 @@ export class WebClientServer {
141140
scopes: [['user:email'], ['repo']]
142141
} : undefined;
143142

@@ -146,28 +145,37 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
146145

147146
const workbenchWebConfiguration = {
148147
remoteAuthority,
149-
@@ -308,6 +306,7 @@ export class WebClientServer {
148+
@@ -309,6 +310,7 @@ export class WebClientServer {
150149
workspaceUri: resolveWorkspaceURI(this._environmentService.args['default-workspace']),
151150
productConfiguration: <Partial<IProductConfiguration>>{
152151
codeServerVersion: this._productService.codeServerVersion,
153152
+ rootEndpoint: base,
154153
embedderIdentifier: 'server-distro',
155154
extensionsGallery: this._webExtensionResourceUrlTemplate ? {
156155
...this._productService.extensionsGallery,
157-
@@ -328,8 +327,10 @@ export class WebClientServer {
156+
@@ -326,8 +328,10 @@ export class WebClientServer {
158157
const values: { [key: string]: string } = {
159158
WORKBENCH_WEB_CONFIGURATION: asJSON(workbenchWebConfiguration),
160159
WORKBENCH_AUTH_SESSION: authSessionInfo ? asJSON(authSessionInfo) : '',
161160
- WORKBENCH_WEB_BASE_URL: this._staticRoute,
162-
- WORKBENCH_NLS_BASE_URL: nlsBaseUrl ? `${nlsBaseUrl}${this._productService.commit}/${this._productService.version}/` : '',
161+
- WORKBENCH_NLS_BASE_URL: nlsBaseUrl ? `${nlsBaseUrl}${!nlsBaseUrl.endsWith('/') ? '/' : ''}${this._productService.commit}/${this._productService.version}/` : '',
163162
+ WORKBENCH_WEB_BASE_URL: vscodeBase + this._staticRoute,
164-
+ WORKBENCH_NLS_BASE_URL: vscodeBase + (nlsBaseUrl ? `${nlsBaseUrl}${this._productService.commit}/${this._productService.version}/` : ''),
163+
+ WORKBENCH_NLS_BASE_URL: vscodeBase + (nlsBaseUrl ? `${nlsBaseUrl}${!nlsBaseUrl.endsWith('/') ? '/' : ''}${this._productService.commit}/${this._productService.version}/` : ''),
165164
+ BASE: base,
166165
+ VS_BASE: vscodeBase,
167166
};
168167

169168

170-
@@ -419,3 +420,70 @@ export class WebClientServer {
169+
@@ -344,7 +348,7 @@ export class WebClientServer {
170+
'default-src \'self\';',
171+
'img-src \'self\' https: data: blob:;',
172+
'media-src \'self\';',
173+
- `script-src 'self' 'unsafe-eval' ${this._getScriptCspHashes(data).join(' ')} 'sha256-fh3TwPMflhsEIpR8g1OYTIMVWhXTLcjQ9kh2tIpmv54=' http://${remoteAuthority};`, // the sha is the same as in src/vs/workbench/services/extensions/worker/webWorkerExtensionHostIframe.html
174+
+ `script-src 'self' 'unsafe-eval' ${this._getScriptCspHashes(data).join(' ')} 'sha256-fh3TwPMflhsEIpR8g1OYTIMVWhXTLcjQ9kh2tIpmv54=';`, // the sha is the same as in src/vs/workbench/services/extensions/worker/webWorkerExtensionHostIframe.html
175+
'child-src \'self\';',
176+
`frame-src 'self' https://*.vscode-cdn.net data:;`,
177+
'worker-src \'self\' data:;',
178+
@@ -417,3 +421,70 @@ export class WebClientServer {
171179
return res.end(data);
172180
}
173181
}

patches/cli-window-open.diff

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Index: code-server/lib/vscode/src/vs/server/node/remoteTerminalChannel.ts
2626
readonly onExecuteCommand = this._onExecuteCommand.event;
2727

2828
constructor(
29-
@@ -240,20 +240,20 @@ export class RemoteTerminalChannel exten
29+
@@ -241,20 +241,20 @@ export class RemoteTerminalChannel exten
3030
const ipcHandlePath = createRandomIPCHandle();
3131
env.VSCODE_IPC_HOOK_CLI = ipcHandlePath;
3232
const commandsExecuter: ICommandsExecuter = {
@@ -52,7 +52,7 @@ Index: code-server/lib/vscode/src/vs/server/node/remoteTerminalChannel.ts
5252
let resolve!: (data: any) => void;
5353
let reject!: (err: any) => void;
5454
const result = new Promise<T>((_resolve, _reject) => {
55-
@@ -276,6 +276,7 @@ export class RemoteTerminalChannel exten
55+
@@ -277,6 +277,7 @@ export class RemoteTerminalChannel exten
5656
});
5757
this._onExecuteCommand.fire({
5858
reqId,

patches/disable-builtin-ext-update.diff

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/extensions/browser/extens
77
===================================================================
88
--- code-server.orig/lib/vscode/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.ts
99
+++ code-server/lib/vscode/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.ts
10-
@@ -234,6 +234,10 @@ export class Extension implements IExten
10+
@@ -237,6 +237,10 @@ export class Extension implements IExten
1111
if (this.type === ExtensionType.System && this.productService.quality === 'stable') {
1212
return false;
1313
}
@@ -18,7 +18,7 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/extensions/browser/extens
1818
if (!this.local.preRelease && this.gallery.properties.isPreReleaseVersion) {
1919
return false;
2020
}
21-
@@ -1088,6 +1092,10 @@ export class ExtensionsWorkbenchService
21+
@@ -1122,6 +1126,10 @@ export class ExtensionsWorkbenchService
2222
// Skip if check updates only for builtin extensions and current extension is not builtin.
2323
continue;
2424
}

patches/disable-downloads.diff

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Index: code-server/lib/vscode/src/vs/workbench/browser/web.api.ts
1212
===================================================================
1313
--- code-server.orig/lib/vscode/src/vs/workbench/browser/web.api.ts
1414
+++ code-server/lib/vscode/src/vs/workbench/browser/web.api.ts
15-
@@ -250,6 +250,11 @@ export interface IWorkbenchConstructionO
15+
@@ -267,6 +267,11 @@ export interface IWorkbenchConstructionO
1616
*/
1717
readonly userDataPath?: string
1818

@@ -52,7 +52,7 @@ Index: code-server/lib/vscode/src/vs/workbench/services/environment/browser/envi
5252
+ }
5353
+
5454
@memoize
55-
get settingsResource(): URI { return joinPath(this.userRoamingDataHome, 'settings.json'); }
55+
get argvResource(): URI { return joinPath(this.userRoamingDataHome, 'argv.json'); }
5656

5757
Index: code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
5858
===================================================================
@@ -66,7 +66,7 @@ Index: code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
6666

6767
/* ----- server setup ----- */
6868

69-
@@ -94,6 +95,7 @@ export interface ServerParsedArgs {
69+
@@ -95,6 +96,7 @@ export interface ServerParsedArgs {
7070
/* ----- code-server ----- */
7171
'disable-update-check'?: boolean;
7272
'auth'?: string
@@ -78,7 +78,7 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
7878
===================================================================
7979
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
8080
+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
81-
@@ -300,6 +300,7 @@ export class WebClientServer {
81+
@@ -304,6 +304,7 @@ export class WebClientServer {
8282
remoteAuthority,
8383
webviewEndpoint: vscodeBase + this._staticRoute + '/out/vs/workbench/contrib/webview/browser/pre',
8484
userDataPath: this._environmentService.userDataPath,
@@ -93,7 +93,7 @@ Index: code-server/lib/vscode/src/vs/workbench/browser/contextkeys.ts
9393
@@ -7,12 +7,11 @@ import { Event } from 'vs/base/common/ev
9494
import { Disposable } from 'vs/base/common/lifecycle';
9595
import { IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/contextkey';
96-
import { InputFocusedContext, IsMacContext, IsLinuxContext, IsWindowsContext, IsWebContext, IsMacNativeContext, IsDevelopmentContext, IsIOSContext } from 'vs/platform/contextkey/common/contextkeys';
96+
import { InputFocusedContext, IsMacContext, IsLinuxContext, IsWindowsContext, IsWebContext, IsMacNativeContext, IsDevelopmentContext, IsIOSContext, ProductQualityContext } from 'vs/platform/contextkey/common/contextkeys';
9797
-import { SplitEditorsVertically, InEditorZenModeContext, ActiveEditorCanRevertContext, ActiveEditorGroupLockedContext, ActiveEditorCanSplitInGroupContext, SideBySideEditorActiveContext, AuxiliaryBarVisibleContext, SideBarVisibleContext, PanelAlignmentContext, PanelMaximizedContext, PanelVisibleContext, ActiveEditorContext, EditorsVisibleContext, TextCompareEditorVisibleContext, TextCompareEditorActiveContext, ActiveEditorGroupEmptyContext, MultipleEditorGroupsContext, EditorTabsVisibleContext, IsCenteredLayoutContext, ActiveEditorGroupIndexContext, ActiveEditorGroupLastContext, ActiveEditorReadonlyContext, EditorAreaVisibleContext, ActiveEditorAvailableEditorIdsContext, DirtyWorkingCopiesContext, EmptyWorkspaceSupportContext, EnterMultiRootWorkspaceSupportContext, HasWebFileSystemAccess, IsFullscreenContext, OpenFolderWorkspaceSupportContext, RemoteNameContext, VirtualWorkspaceContext, WorkbenchStateContext, WorkspaceFolderCountContext, PanelPositionContext } from 'vs/workbench/common/contextkeys';
9898
+import { SplitEditorsVertically, InEditorZenModeContext, ActiveEditorCanRevertContext, ActiveEditorGroupLockedContext, ActiveEditorCanSplitInGroupContext, SideBySideEditorActiveContext, AuxiliaryBarVisibleContext, SideBarVisibleContext, PanelAlignmentContext, PanelMaximizedContext, PanelVisibleContext, ActiveEditorContext, EditorsVisibleContext, TextCompareEditorVisibleContext, TextCompareEditorActiveContext, ActiveEditorGroupEmptyContext, MultipleEditorGroupsContext, EditorTabsVisibleContext, IsCenteredLayoutContext, ActiveEditorGroupIndexContext, ActiveEditorGroupLastContext, ActiveEditorReadonlyContext, EditorAreaVisibleContext, ActiveEditorAvailableEditorIdsContext, DirtyWorkingCopiesContext, EmptyWorkspaceSupportContext, EnterMultiRootWorkspaceSupportContext, HasWebFileSystemAccess, IsFullscreenContext, OpenFolderWorkspaceSupportContext, RemoteNameContext, VirtualWorkspaceContext, WorkbenchStateContext, WorkspaceFolderCountContext, PanelPositionContext, IsEnabledFileDownloads } from 'vs/workbench/common/contextkeys';
9999
import { TEXT_DIFF_EDITOR_ID, EditorInputCapabilities, SIDE_BY_SIDE_EDITOR_ID, DEFAULT_EDITOR_ASSOCIATION } from 'vs/workbench/common/editor';
@@ -104,24 +104,24 @@ Index: code-server/lib/vscode/src/vs/workbench/browser/contextkeys.ts
104104
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
105105
import { WorkbenchState, IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
106106
import { IWorkbenchLayoutService, Parts, positionToString } from 'vs/workbench/services/layout/browser/layoutService';
107-
@@ -24,6 +23,7 @@ import { IEditorResolverService } from '
108-
import { IPaneCompositePartService } from 'vs/workbench/services/panecomposite/browser/panecomposite';
107+
@@ -25,6 +24,7 @@ import { IPaneCompositePartService } fro
109108
import { Schemas } from 'vs/base/common/network';
110109
import { WebFileSystemAccess } from 'vs/platform/files/browser/webFileSystemAccess';
111-
+import { IBrowserWorkbenchEnvironmentService } from '../services/environment/browser/environmentService';
110+
import { IProductService } from 'vs/platform/product/common/productService';
111+
+import { IBrowserWorkbenchEnvironmentService } from 'vs/workbench/services/environment/browser/environmentService';
112112

113113
export class WorkbenchContextKeysHandler extends Disposable {
114114
private inputFocusedContext: IContextKey<boolean>;
115-
@@ -75,7 +75,7 @@ export class WorkbenchContextKeysHandler
115+
@@ -76,7 +76,7 @@ export class WorkbenchContextKeysHandler
116116
@IContextKeyService private readonly contextKeyService: IContextKeyService,
117117
@IWorkspaceContextService private readonly contextService: IWorkspaceContextService,
118118
@IConfigurationService private readonly configurationService: IConfigurationService,
119119
- @IWorkbenchEnvironmentService private readonly environmentService: IWorkbenchEnvironmentService,
120120
+ @IBrowserWorkbenchEnvironmentService private readonly environmentService: IBrowserWorkbenchEnvironmentService,
121+
@IProductService private readonly productService: IProductService,
121122
@IEditorService private readonly editorService: IEditorService,
122123
@IEditorResolverService private readonly editorResolverService: IEditorResolverService,
123-
@IEditorGroupsService private readonly editorGroupService: IEditorGroupsService,
124-
@@ -194,6 +194,9 @@ export class WorkbenchContextKeysHandler
124+
@@ -199,6 +199,9 @@ export class WorkbenchContextKeysHandler
125125
this.auxiliaryBarVisibleContext = AuxiliaryBarVisibleContext.bindTo(this.contextKeyService);
126126
this.auxiliaryBarVisibleContext.set(this.layoutService.isVisible(Parts.AUXILIARYBAR_PART));
127127

0 commit comments

Comments
 (0)