Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit c7fb1a9

Browse files
authoredMay 8, 2024
Merge branch 'main' into fix/node-upgrade-cve
2 parents 9317e79 + ab4b36f commit c7fb1a9

17 files changed

+129
-83
lines changed
 

‎.github/workflows/build.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ jobs:
8383
8484
- name: Install helm
8585
if: steps.changed-files.outputs.any_changed == 'true'
86-
uses: azure/setup-helm@v3.5
86+
uses: azure/setup-helm@v4
8787
with:
8888
token: ${{ secrets.GITHUB_TOKEN }}
8989

‎.github/workflows/publish.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
cache: "yarn"
3737

3838
- name: Download npm package from release artifacts
39-
uses: robinraju/release-downloader@v1.9
39+
uses: robinraju/release-downloader@v1.10
4040
with:
4141
repository: "coder/code-server"
4242
tag: ${{ github.event.inputs.version || github.ref_name }}
@@ -184,15 +184,15 @@ jobs:
184184
echo "VERSION=${TAG#v}" >> $GITHUB_ENV
185185
186186
- name: Download deb artifacts
187-
uses: robinraju/release-downloader@v1.9
187+
uses: robinraju/release-downloader@v1.10
188188
with:
189189
repository: "coder/code-server"
190190
tag: v${{ env.VERSION }}
191191
fileName: "*.deb"
192192
out-file-path: "release-packages"
193193

194194
- name: Download rpm artifacts
195-
uses: robinraju/release-downloader@v1.9
195+
uses: robinraju/release-downloader@v1.10
196196
with:
197197
repository: "coder/code-server"
198198
tag: v${{ env.VERSION }}

‎.github/workflows/release.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ jobs:
222222
# next update Node we can probably remove this. For now, install
223223
# setuptools since it contains distutils.
224224
- name: Install Python utilities
225-
run: python3 -m pip install setuptools
225+
run: brew install python-setuptools
226226

227227
- name: Download npm package
228228
uses: actions/download-artifact@v4

‎lib/vscode

Submodule vscode updated 1076 files

‎patches/base-path.diff

+1-1
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-
@@ -198,7 +198,9 @@ class RemoteAuthoritiesImpl {
13+
@@ -205,7 +205,9 @@ class RemoteAuthoritiesImpl {
1414
return URI.from({
1515
scheme: platform.isWeb ? this._preferredWebSchema : Schemas.vscodeRemoteResource,
1616
authority: `${host}:${port}`,

‎patches/disable-builtin-ext-update.diff

+1-1
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-
@@ -283,6 +283,10 @@ export class Extension implements IExten
10+
@@ -284,6 +284,10 @@ export class Extension implements IExten
1111
if (this.type === ExtensionType.System && this.productService.quality === 'stable') {
1212
return false;
1313
}

‎patches/display-language.diff

+4-4
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Index: code-server/lib/vscode/src/vs/server/node/serverServices.ts
3030
import { ProtocolConstants } from 'vs/base/parts/ipc/common/ipc.net';
3131
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
3232
import { ConfigurationService } from 'vs/platform/configuration/common/configurationService';
33-
@@ -228,6 +228,9 @@ export async function setupServerService
33+
@@ -240,6 +240,9 @@ export async function setupServerService
3434
const channel = new ExtensionManagementChannel(extensionManagementService, (ctx: RemoteAgentConnectionContext) => getUriTransformer(ctx.remoteAuthority));
3535
socketServer.registerChannel('extensions', channel);
3636

@@ -220,7 +220,7 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
220220
import { CharCode } from 'vs/base/common/charCode';
221221
import { IExtensionManifest } from 'vs/platform/extensions/common/extensions';
222222

223-
@@ -347,6 +348,8 @@ export class WebClientServer {
223+
@@ -348,6 +349,8 @@ export class WebClientServer {
224224
callbackRoute: this._callbackRoute
225225
};
226226

@@ -229,7 +229,7 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
229229
const nlsBaseUrl = this._productService.extensionsGallery?.nlsBaseUrl;
230230
const values: { [key: string]: string } = {
231231
WORKBENCH_WEB_CONFIGURATION: asJSON(workbenchWebConfiguration),
232-
@@ -355,6 +358,7 @@ export class WebClientServer {
232+
@@ -356,6 +359,7 @@ export class WebClientServer {
233233
WORKBENCH_NLS_BASE_URL: vscodeBase + (nlsBaseUrl ? `${nlsBaseUrl}${!nlsBaseUrl.endsWith('/') ? '/' : ''}${this._productService.commit}/${this._productService.version}/` : ''),
234234
BASE: base,
235235
VS_BASE: vscodeBase,
@@ -250,7 +250,7 @@ Index: code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
250250
/* ----- server setup ----- */
251251

252252
@@ -103,6 +104,7 @@ export interface ServerParsedArgs {
253-
'auth'?: string
253+
'auth'?: string;
254254
'disable-file-downloads'?: boolean;
255255
'disable-file-uploads'?: boolean;
256256
+ 'locale'?: string

‎patches/external-file-actions.diff

+5-5
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Index: code-server/lib/vscode/src/vs/workbench/browser/web.api.ts
2727
===================================================================
2828
--- code-server.orig/lib/vscode/src/vs/workbench/browser/web.api.ts
2929
+++ code-server/lib/vscode/src/vs/workbench/browser/web.api.ts
30-
@@ -289,6 +289,16 @@ export interface IWorkbenchConstructionO
30+
@@ -303,6 +303,16 @@ export interface IWorkbenchConstructionO
3131
*/
3232
readonly userDataPath?: string
3333

@@ -102,7 +102,7 @@ Index: code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
102102
@@ -99,6 +101,8 @@ export interface ServerParsedArgs {
103103
/* ----- code-server ----- */
104104
'disable-update-check'?: boolean;
105-
'auth'?: string
105+
'auth'?: string;
106106
+ 'disable-file-downloads'?: boolean;
107107
+ 'disable-file-uploads'?: boolean;
108108

@@ -173,7 +173,7 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/files/browser/fileActions
173173
import { IsWebContext } from 'vs/platform/contextkey/common/contextkeys';
174174
import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
175175
import { ThemeIcon } from 'vs/base/common/themables';
176-
@@ -550,13 +550,16 @@ MenuRegistry.appendMenuItem(MenuId.Explo
176+
@@ -553,13 +553,16 @@ MenuRegistry.appendMenuItem(MenuId.Explo
177177
id: DOWNLOAD_COMMAND_ID,
178178
title: DOWNLOAD_LABEL
179179
},
@@ -197,7 +197,7 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/files/browser/fileActions
197197
)
198198
}));
199199

200-
@@ -568,6 +571,7 @@ MenuRegistry.appendMenuItem(MenuId.Explo
200+
@@ -571,6 +574,7 @@ MenuRegistry.appendMenuItem(MenuId.Explo
201201
title: UPLOAD_LABEL,
202202
},
203203
when: ContextKeyExpr.and(
@@ -287,7 +287,7 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/files/browser/views/explo
287287
import { mainWindow } from 'vs/base/browser/window';
288288
import { IExplorerFileContribution, explorerFileContribRegistry } from 'vs/workbench/contrib/files/browser/explorerFileContrib';
289289
+import { IBrowserWorkbenchEnvironmentService } from 'vs/workbench/services/environment/browser/environmentService';
290-
import { IHoverWidget } from 'vs/base/browser/ui/hover/updatableHoverWidget';
290+
import type { IHoverWidget } from 'vs/base/browser/ui/hover/hover';
291291

292292
export class ExplorerDelegate implements IListVirtualDelegate<ExplorerItem> {
293293
@@ -1080,7 +1081,8 @@ export class FileDragAndDrop implements

‎patches/getting-started.diff

+5-5
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/welcomeGettingStarted/bro
1919
import { renderFormattedText } from 'vs/base/browser/formattedTextRenderer';
2020
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
2121
import { Button } from 'vs/base/browser/ui/button/button';
22-
@@ -55,7 +55,7 @@ import { IRecentFolder, IRecentWorkspace
22+
@@ -54,7 +54,7 @@ import { IRecentFolder, IRecentWorkspace
2323
import { OpenRecentAction } from 'vs/workbench/browser/actions/windowActions';
2424
import { OpenFileFolderAction, OpenFolderAction, OpenFolderViaWorkspaceAction } from 'vs/workbench/browser/actions/workspaceActions';
2525
import { EditorPane } from 'vs/workbench/browser/parts/editor/editorPane';
@@ -28,7 +28,7 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/welcomeGettingStarted/bro
2828
import { IEditorOpenContext, IEditorSerializer } from 'vs/workbench/common/editor';
2929
import { IWebviewElement, IWebviewService } from 'vs/workbench/contrib/webview/browser/webview';
3030
import 'vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedColors';
31-
@@ -813,6 +813,72 @@ export class GettingStartedPage extends
31+
@@ -816,6 +816,72 @@ export class GettingStartedPage extends
3232
$('p.subtitle.description', {}, localize({ key: 'gettingStarted.editingEvolved', comment: ['Shown as subtitle on the Welcome page.'] }, "Editing evolved"))
3333
);
3434

@@ -101,7 +101,7 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/welcomeGettingStarted/bro
101101
const leftColumn = $('.categories-column.categories-column-left', {},);
102102
const rightColumn = $('.categories-column.categories-column-right', {},);
103103

104-
@@ -884,6 +950,9 @@ export class GettingStartedPage extends
104+
@@ -887,6 +953,9 @@ export class GettingStartedPage extends
105105
recentList.setLimit(5);
106106
reset(leftColumn, startList.getDomElement(), recentList.getDomElement());
107107
}
@@ -135,7 +135,7 @@ Index: code-server/lib/vscode/src/vs/workbench/browser/web.api.ts
135135
===================================================================
136136
--- code-server.orig/lib/vscode/src/vs/workbench/browser/web.api.ts
137137
+++ code-server/lib/vscode/src/vs/workbench/browser/web.api.ts
138-
@@ -299,6 +299,11 @@ export interface IWorkbenchConstructionO
138+
@@ -313,6 +313,11 @@ export interface IWorkbenchConstructionO
139139
*/
140140
readonly isEnabledFileUploads?: boolean
141141

@@ -201,7 +201,7 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
201201
===================================================================
202202
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
203203
+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
204-
@@ -338,6 +338,7 @@ export class WebClientServer {
204+
@@ -339,6 +339,7 @@ export class WebClientServer {
205205
userDataPath: this._environmentService.userDataPath,
206206
isEnabledFileDownloads: !this._environmentService.args['disable-file-downloads'],
207207
isEnabledFileUploads: !this._environmentService.args['disable-file-uploads'],

‎patches/integration.diff

+1-1
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ Index: code-server/lib/vscode/src/vs/workbench/browser/web.main.ts
184184
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
185185
import { IProgressService } from 'vs/platform/progress/common/progress';
186186
import { DelayedLogChannel } from 'vs/workbench/services/output/common/delayedLogChannel';
187-
@@ -130,6 +131,9 @@ export class BrowserMain extends Disposa
187+
@@ -131,6 +132,9 @@ export class BrowserMain extends Disposa
188188
// Startup
189189
const instantiationService = workbench.startup();
190190

‎patches/local-storage.diff

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Index: code-server/lib/vscode/src/vs/workbench/browser/web.api.ts
3030
===================================================================
3131
--- code-server.orig/lib/vscode/src/vs/workbench/browser/web.api.ts
3232
+++ code-server/lib/vscode/src/vs/workbench/browser/web.api.ts
33-
@@ -284,6 +284,11 @@ export interface IWorkbenchConstructionO
33+
@@ -298,6 +298,11 @@ export interface IWorkbenchConstructionO
3434
*/
3535
readonly configurationDefaults?: Record<string, any>;
3636

‎patches/logout.diff

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Index: code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
3232
export interface ServerParsedArgs {
3333
/* ----- code-server ----- */
3434
'disable-update-check'?: boolean;
35-
+ 'auth'?: string
35+
+ 'auth'?: string;
3636

3737
/* ----- server setup ----- */
3838

‎patches/telemetry.diff

+56-9
Original file line numberDiff line numberDiff line change
@@ -20,30 +20,47 @@ Index: code-server/lib/vscode/src/vs/server/node/serverServices.ts
2020
import { NullPolicyService } from 'vs/platform/policy/common/policy';
2121
import { OneDataSystemAppender } from 'vs/platform/telemetry/node/1dsAppender';
2222
import { LoggerService } from 'vs/platform/log/node/loggerService';
23-
@@ -149,7 +150,10 @@ export async function setupServerService
23+
@@ -146,11 +147,23 @@ export async function setupServerService
24+
const requestService = new RequestService(configurationService, environmentService, logService, loggerService);
25+
services.set(IRequestService, requestService);
26+
27+
+ let isContainer = undefined;
28+
+ try {
29+
+ await Promises.stat('/run/.containerenv');
30+
+ isContainer = true;
31+
+ } catch (error) { /* Does not exist, probably. */ }
32+
+ if (!isContainer) {
33+
+ try {
34+
+ const content = await Promises.readFile('/proc/self/cgroup', 'utf8')
35+
+ isContainer = content.includes('docker');
36+
+ } catch (error) { /* Permission denied, probably. */ }
37+
+ }
38+
+
2439
let oneDsAppender: ITelemetryAppender = NullAppender;
2540
const isInternal = isInternalTelemetry(productService, configurationService);
2641
if (supportsTelemetry(productService, environmentService)) {
2742
- if (!isLoggingOnly(productService, environmentService) && productService.aiConfig?.ariaKey) {
28-
+ const telemetryEndpoint = process.env.CS_TELEMETRY_URL || "https://v1.telemetry.coder.com/track";
29-
+ if (telemetryEndpoint) {
30-
+ oneDsAppender = new OneDataSystemAppender(requestService, false, eventPrefix, null, () => new TelemetryClient(telemetryEndpoint));
31-
+ } else if (!isLoggingOnly(productService, environmentService) && productService.aiConfig?.ariaKey) {
32-
oneDsAppender = new OneDataSystemAppender(requestService, isInternal, eventPrefix, null, productService.aiConfig.ariaKey);
43+
- oneDsAppender = new OneDataSystemAppender(requestService, isInternal, eventPrefix, null, productService.aiConfig.ariaKey);
44+
+ if (!isLoggingOnly(productService, environmentService) && productService.telemetryEndpoint) {
45+
+ oneDsAppender = new OneDataSystemAppender(requestService, isInternal, eventPrefix, null, () => new TelemetryClient(productService.telemetryEndpoint!, machineId, isContainer));
3346
disposables.add(toDisposable(() => oneDsAppender?.flush())); // Ensure the AI appender is disposed so that it flushes remaining data
3447
}
48+
3549
Index: code-server/lib/vscode/src/vs/server/node/telemetryClient.ts
3650
===================================================================
3751
--- /dev/null
3852
+++ code-server/lib/vscode/src/vs/server/node/telemetryClient.ts
39-
@@ -0,0 +1,49 @@
53+
@@ -0,0 +1,55 @@
4054
+import { AppInsightsCore, IExtendedTelemetryItem, ITelemetryItem } from '@microsoft/1ds-core-js';
4155
+import * as https from 'https';
4256
+import * as http from 'http';
4357
+import * as os from 'os';
4458
+
4559
+export class TelemetryClient extends AppInsightsCore {
46-
+ public constructor(private readonly endpoint: string) {
60+
+ public constructor(
61+
+ private readonly endpoint: string,
62+
+ private readonly machineId: string,
63+
+ private readonly isContainer: Boolean | undefined) {
4764
+ super();
4865
+ }
4966
+
@@ -73,6 +90,9 @@ Index: code-server/lib/vscode/src/vs/server/node/telemetryClient.ts
7390
+ options.properties['common.arch'] = os.arch();
7491
+ } catch (error) {}
7592
+
93+
+ options.properties['common.remoteMachineId'] = this.machineId;
94+
+ options.properties['common.isContainer'] = this.isContainer;
95+
+
7696
+ try {
7797
+ const request = (/^http:/.test(this.endpoint) ? http : https).request(this.endpoint, {
7898
+ method: 'POST',
@@ -90,11 +110,38 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
90110
===================================================================
91111
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
92112
+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
93-
@@ -318,6 +318,7 @@ export class WebClientServer {
113+
@@ -318,6 +318,8 @@ export class WebClientServer {
94114
scope: vscodeBase + '/',
95115
path: base + '/_static/out/browser/serviceWorker.js',
96116
},
97117
+ enableTelemetry: this._productService.enableTelemetry,
118+
+ telemetryEndpoint: this._productService.telemetryEndpoint,
98119
embedderIdentifier: 'server-distro',
99120
extensionsGallery: this._productService.extensionsGallery,
100121
};
122+
Index: code-server/lib/vscode/src/vs/base/common/product.ts
123+
===================================================================
124+
--- code-server.orig/lib/vscode/src/vs/base/common/product.ts
125+
+++ code-server/lib/vscode/src/vs/base/common/product.ts
126+
@@ -64,6 +64,7 @@ export interface IProductConfiguration {
127+
readonly path: string;
128+
readonly scope: string;
129+
}
130+
+ readonly telemetryEndpoint?: string
131+
132+
readonly version: string;
133+
readonly date?: string;
134+
Index: code-server/lib/vscode/src/vs/platform/product/common/product.ts
135+
===================================================================
136+
--- code-server.orig/lib/vscode/src/vs/platform/product/common/product.ts
137+
+++ code-server/lib/vscode/src/vs/platform/product/common/product.ts
138+
@@ -55,7 +55,8 @@ else if (globalThis._VSCODE_PRODUCT_JSON
139+
resourceUrlTemplate: "https://open-vsx.org/vscode/asset/{publisher}/{name}/{version}/Microsoft.VisualStudio.Code.WebResources/{path}",
140+
controlUrl: "",
141+
recommendationsUrl: "",
142+
- })
143+
+ }),
144+
+ telemetryEndpoint: env.CS_TELEMETRY_URL || product.telemetryEndpoint || "https://v1.telemetry.coder.com/track",
145+
});
146+
}
147+

‎src/node/cli.ts

+4-7
Original file line numberDiff line numberDiff line change
@@ -833,8 +833,8 @@ export interface CodeArgs extends UserProvidedCodeArgs {
833833
version: boolean
834834
"without-connection-token"?: boolean
835835
"without-browser-env-var"?: boolean
836-
compatibility: string
837-
log: string[] | undefined
836+
compatibility?: string
837+
log?: string[]
838838
}
839839

840840
/**
@@ -843,15 +843,12 @@ export interface CodeArgs extends UserProvidedCodeArgs {
843843
export type SpawnCodeCli = (args: CodeArgs) => Promise<void>
844844

845845
/**
846-
* Convert our arguments to VS Code server arguments.
846+
* Convert our arguments to equivalent VS Code server arguments.
847+
* Does not add any extra arguments.
847848
*/
848849
export const toCodeArgs = async (args: DefaultedArgs): Promise<CodeArgs> => {
849850
return {
850851
...args,
851-
"accept-server-license-terms": true,
852-
// This seems to be used to make the connection token flags optional (when
853-
// set to 1.63) but we have always included them.
854-
compatibility: "1.64",
855852
/** Type casting. */
856853
help: !!args.help,
857854
version: !!args.version,

‎src/node/routes/vscode.ts

+4
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ export const ensureVSCodeLoaded = async (
5454
try {
5555
vscodeServer = await createVSServer(null, {
5656
...(await toCodeArgs(req.args)),
57+
"accept-server-license-terms": true,
58+
// This seems to be used to make the connection token flags optional (when
59+
// set to 1.63) but we have always included them.
60+
compatibility: "1.64",
5761
"without-connection-token": true,
5862
})
5963
} catch (error) {

‎test/unit/node/cli.test.ts

-2
Original file line numberDiff line numberDiff line change
@@ -912,8 +912,6 @@ cert: false`)
912912
describe("toCodeArgs", () => {
913913
const vscodeDefaults = {
914914
...defaults,
915-
"accept-server-license-terms": true,
916-
compatibility: "1.64",
917915
help: false,
918916
port: "8080",
919917
version: false,

0 commit comments

Comments
 (0)
Please sign in to comment.