Skip to content

Commit

Permalink
Merge branch 'main' into fix/node-upgrade-cve
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandersperling committed May 8, 2024
2 parents 9317e79 + ab4b36f commit c7fb1a9
Show file tree
Hide file tree
Showing 17 changed files with 129 additions and 83 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ jobs:
- name: Install helm
if: steps.changed-files.outputs.any_changed == 'true'
uses: azure/setup-helm@v3.5
uses: azure/setup-helm@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
cache: "yarn"

- name: Download npm package from release artifacts
uses: robinraju/release-downloader@v1.9
uses: robinraju/release-downloader@v1.10
with:
repository: "coder/code-server"
tag: ${{ github.event.inputs.version || github.ref_name }}
Expand Down Expand Up @@ -184,15 +184,15 @@ jobs:
echo "VERSION=${TAG#v}" >> $GITHUB_ENV
- name: Download deb artifacts
uses: robinraju/release-downloader@v1.9
uses: robinraju/release-downloader@v1.10
with:
repository: "coder/code-server"
tag: v${{ env.VERSION }}
fileName: "*.deb"
out-file-path: "release-packages"

- name: Download rpm artifacts
uses: robinraju/release-downloader@v1.9
uses: robinraju/release-downloader@v1.10
with:
repository: "coder/code-server"
tag: v${{ env.VERSION }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ jobs:
# next update Node we can probably remove this. For now, install
# setuptools since it contains distutils.
- name: Install Python utilities
run: python3 -m pip install setuptools
run: brew install python-setuptools

- name: Download npm package
uses: actions/download-artifact@v4
Expand Down
2 changes: 1 addition & 1 deletion lib/vscode
Submodule vscode updated 1076 files
2 changes: 1 addition & 1 deletion patches/base-path.diff
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Index: code-server/lib/vscode/src/vs/base/common/network.ts
===================================================================
--- code-server.orig/lib/vscode/src/vs/base/common/network.ts
+++ code-server/lib/vscode/src/vs/base/common/network.ts
@@ -198,7 +198,9 @@ class RemoteAuthoritiesImpl {
@@ -205,7 +205,9 @@ class RemoteAuthoritiesImpl {
return URI.from({
scheme: platform.isWeb ? this._preferredWebSchema : Schemas.vscodeRemoteResource,
authority: `${host}:${port}`,
Expand Down
2 changes: 1 addition & 1 deletion patches/disable-builtin-ext-update.diff
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/extensions/browser/extens
===================================================================
--- code-server.orig/lib/vscode/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.ts
+++ code-server/lib/vscode/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.ts
@@ -283,6 +283,10 @@ export class Extension implements IExten
@@ -284,6 +284,10 @@ export class Extension implements IExten
if (this.type === ExtensionType.System && this.productService.quality === 'stable') {
return false;
}
Expand Down
8 changes: 4 additions & 4 deletions patches/display-language.diff
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Index: code-server/lib/vscode/src/vs/server/node/serverServices.ts
import { ProtocolConstants } from 'vs/base/parts/ipc/common/ipc.net';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { ConfigurationService } from 'vs/platform/configuration/common/configurationService';
@@ -228,6 +228,9 @@ export async function setupServerService
@@ -240,6 +240,9 @@ export async function setupServerService
const channel = new ExtensionManagementChannel(extensionManagementService, (ctx: RemoteAgentConnectionContext) => getUriTransformer(ctx.remoteAuthority));
socketServer.registerChannel('extensions', channel);

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

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

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

@@ -103,6 +104,7 @@ export interface ServerParsedArgs {
'auth'?: string
'auth'?: string;
'disable-file-downloads'?: boolean;
'disable-file-uploads'?: boolean;
+ 'locale'?: string
Expand Down
10 changes: 5 additions & 5 deletions patches/external-file-actions.diff
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Index: code-server/lib/vscode/src/vs/workbench/browser/web.api.ts
===================================================================
--- code-server.orig/lib/vscode/src/vs/workbench/browser/web.api.ts
+++ code-server/lib/vscode/src/vs/workbench/browser/web.api.ts
@@ -289,6 +289,16 @@ export interface IWorkbenchConstructionO
@@ -303,6 +303,16 @@ export interface IWorkbenchConstructionO
*/
readonly userDataPath?: string

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

Expand Down Expand Up @@ -173,7 +173,7 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/files/browser/fileActions
import { IsWebContext } from 'vs/platform/contextkey/common/contextkeys';
import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
import { ThemeIcon } from 'vs/base/common/themables';
@@ -550,13 +550,16 @@ MenuRegistry.appendMenuItem(MenuId.Explo
@@ -553,13 +553,16 @@ MenuRegistry.appendMenuItem(MenuId.Explo
id: DOWNLOAD_COMMAND_ID,
title: DOWNLOAD_LABEL
},
Expand All @@ -197,7 +197,7 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/files/browser/fileActions
)
}));

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

export class ExplorerDelegate implements IListVirtualDelegate<ExplorerItem> {
@@ -1080,7 +1081,8 @@ export class FileDragAndDrop implements
Expand Down
10 changes: 5 additions & 5 deletions patches/getting-started.diff
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/welcomeGettingStarted/bro
import { renderFormattedText } from 'vs/base/browser/formattedTextRenderer';
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { Button } from 'vs/base/browser/ui/button/button';
@@ -55,7 +55,7 @@ import { IRecentFolder, IRecentWorkspace
@@ -54,7 +54,7 @@ import { IRecentFolder, IRecentWorkspace
import { OpenRecentAction } from 'vs/workbench/browser/actions/windowActions';
import { OpenFileFolderAction, OpenFolderAction, OpenFolderViaWorkspaceAction } from 'vs/workbench/browser/actions/workspaceActions';
import { EditorPane } from 'vs/workbench/browser/parts/editor/editorPane';
Expand All @@ -28,7 +28,7 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/welcomeGettingStarted/bro
import { IEditorOpenContext, IEditorSerializer } from 'vs/workbench/common/editor';
import { IWebviewElement, IWebviewService } from 'vs/workbench/contrib/webview/browser/webview';
import 'vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedColors';
@@ -813,6 +813,72 @@ export class GettingStartedPage extends
@@ -816,6 +816,72 @@ export class GettingStartedPage extends
$('p.subtitle.description', {}, localize({ key: 'gettingStarted.editingEvolved', comment: ['Shown as subtitle on the Welcome page.'] }, "Editing evolved"))
);

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

@@ -884,6 +950,9 @@ export class GettingStartedPage extends
@@ -887,6 +953,9 @@ export class GettingStartedPage extends
recentList.setLimit(5);
reset(leftColumn, startList.getDomElement(), recentList.getDomElement());
}
Expand Down Expand Up @@ -135,7 +135,7 @@ Index: code-server/lib/vscode/src/vs/workbench/browser/web.api.ts
===================================================================
--- code-server.orig/lib/vscode/src/vs/workbench/browser/web.api.ts
+++ code-server/lib/vscode/src/vs/workbench/browser/web.api.ts
@@ -299,6 +299,11 @@ export interface IWorkbenchConstructionO
@@ -313,6 +313,11 @@ export interface IWorkbenchConstructionO
*/
readonly isEnabledFileUploads?: boolean

Expand Down Expand Up @@ -201,7 +201,7 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
===================================================================
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
@@ -338,6 +338,7 @@ export class WebClientServer {
@@ -339,6 +339,7 @@ export class WebClientServer {
userDataPath: this._environmentService.userDataPath,
isEnabledFileDownloads: !this._environmentService.args['disable-file-downloads'],
isEnabledFileUploads: !this._environmentService.args['disable-file-uploads'],
Expand Down
2 changes: 1 addition & 1 deletion patches/integration.diff
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ Index: code-server/lib/vscode/src/vs/workbench/browser/web.main.ts
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IProgressService } from 'vs/platform/progress/common/progress';
import { DelayedLogChannel } from 'vs/workbench/services/output/common/delayedLogChannel';
@@ -130,6 +131,9 @@ export class BrowserMain extends Disposa
@@ -131,6 +132,9 @@ export class BrowserMain extends Disposa
// Startup
const instantiationService = workbench.startup();

Expand Down
2 changes: 1 addition & 1 deletion patches/local-storage.diff
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Index: code-server/lib/vscode/src/vs/workbench/browser/web.api.ts
===================================================================
--- code-server.orig/lib/vscode/src/vs/workbench/browser/web.api.ts
+++ code-server/lib/vscode/src/vs/workbench/browser/web.api.ts
@@ -284,6 +284,11 @@ export interface IWorkbenchConstructionO
@@ -298,6 +298,11 @@ export interface IWorkbenchConstructionO
*/
readonly configurationDefaults?: Record<string, any>;

Expand Down
2 changes: 1 addition & 1 deletion patches/logout.diff
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Index: code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
export interface ServerParsedArgs {
/* ----- code-server ----- */
'disable-update-check'?: boolean;
+ 'auth'?: string
+ 'auth'?: string;

/* ----- server setup ----- */

Expand Down
65 changes: 56 additions & 9 deletions patches/telemetry.diff
Original file line number Diff line number Diff line change
Expand Up @@ -20,30 +20,47 @@ Index: code-server/lib/vscode/src/vs/server/node/serverServices.ts
import { NullPolicyService } from 'vs/platform/policy/common/policy';
import { OneDataSystemAppender } from 'vs/platform/telemetry/node/1dsAppender';
import { LoggerService } from 'vs/platform/log/node/loggerService';
@@ -149,7 +150,10 @@ export async function setupServerService
@@ -146,11 +147,23 @@ export async function setupServerService
const requestService = new RequestService(configurationService, environmentService, logService, loggerService);
services.set(IRequestService, requestService);

+ let isContainer = undefined;
+ try {
+ await Promises.stat('/run/.containerenv');
+ isContainer = true;
+ } catch (error) { /* Does not exist, probably. */ }
+ if (!isContainer) {
+ try {
+ const content = await Promises.readFile('/proc/self/cgroup', 'utf8')
+ isContainer = content.includes('docker');
+ } catch (error) { /* Permission denied, probably. */ }
+ }
+
let oneDsAppender: ITelemetryAppender = NullAppender;
const isInternal = isInternalTelemetry(productService, configurationService);
if (supportsTelemetry(productService, environmentService)) {
- if (!isLoggingOnly(productService, environmentService) && productService.aiConfig?.ariaKey) {
+ const telemetryEndpoint = process.env.CS_TELEMETRY_URL || "https://v1.telemetry.coder.com/track";
+ if (telemetryEndpoint) {
+ oneDsAppender = new OneDataSystemAppender(requestService, false, eventPrefix, null, () => new TelemetryClient(telemetryEndpoint));
+ } else if (!isLoggingOnly(productService, environmentService) && productService.aiConfig?.ariaKey) {
oneDsAppender = new OneDataSystemAppender(requestService, isInternal, eventPrefix, null, productService.aiConfig.ariaKey);
- oneDsAppender = new OneDataSystemAppender(requestService, isInternal, eventPrefix, null, productService.aiConfig.ariaKey);
+ if (!isLoggingOnly(productService, environmentService) && productService.telemetryEndpoint) {
+ oneDsAppender = new OneDataSystemAppender(requestService, isInternal, eventPrefix, null, () => new TelemetryClient(productService.telemetryEndpoint!, machineId, isContainer));
disposables.add(toDisposable(() => oneDsAppender?.flush())); // Ensure the AI appender is disposed so that it flushes remaining data
}

Index: code-server/lib/vscode/src/vs/server/node/telemetryClient.ts
===================================================================
--- /dev/null
+++ code-server/lib/vscode/src/vs/server/node/telemetryClient.ts
@@ -0,0 +1,49 @@
@@ -0,0 +1,55 @@
+import { AppInsightsCore, IExtendedTelemetryItem, ITelemetryItem } from '@microsoft/1ds-core-js';
+import * as https from 'https';
+import * as http from 'http';
+import * as os from 'os';
+
+export class TelemetryClient extends AppInsightsCore {
+ public constructor(private readonly endpoint: string) {
+ public constructor(
+ private readonly endpoint: string,
+ private readonly machineId: string,
+ private readonly isContainer: Boolean | undefined) {
+ super();
+ }
+
Expand Down Expand Up @@ -73,6 +90,9 @@ Index: code-server/lib/vscode/src/vs/server/node/telemetryClient.ts
+ options.properties['common.arch'] = os.arch();
+ } catch (error) {}
+
+ options.properties['common.remoteMachineId'] = this.machineId;
+ options.properties['common.isContainer'] = this.isContainer;
+
+ try {
+ const request = (/^http:/.test(this.endpoint) ? http : https).request(this.endpoint, {
+ method: 'POST',
Expand All @@ -90,11 +110,38 @@ Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
===================================================================
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
@@ -318,6 +318,7 @@ export class WebClientServer {
@@ -318,6 +318,8 @@ export class WebClientServer {
scope: vscodeBase + '/',
path: base + '/_static/out/browser/serviceWorker.js',
},
+ enableTelemetry: this._productService.enableTelemetry,
+ telemetryEndpoint: this._productService.telemetryEndpoint,
embedderIdentifier: 'server-distro',
extensionsGallery: this._productService.extensionsGallery,
};
Index: code-server/lib/vscode/src/vs/base/common/product.ts
===================================================================
--- code-server.orig/lib/vscode/src/vs/base/common/product.ts
+++ code-server/lib/vscode/src/vs/base/common/product.ts
@@ -64,6 +64,7 @@ export interface IProductConfiguration {
readonly path: string;
readonly scope: string;
}
+ readonly telemetryEndpoint?: string

readonly version: string;
readonly date?: string;
Index: code-server/lib/vscode/src/vs/platform/product/common/product.ts
===================================================================
--- code-server.orig/lib/vscode/src/vs/platform/product/common/product.ts
+++ code-server/lib/vscode/src/vs/platform/product/common/product.ts
@@ -55,7 +55,8 @@ else if (globalThis._VSCODE_PRODUCT_JSON
resourceUrlTemplate: "https://open-vsx.org/vscode/asset/{publisher}/{name}/{version}/Microsoft.VisualStudio.Code.WebResources/{path}",
controlUrl: "",
recommendationsUrl: "",
- })
+ }),
+ telemetryEndpoint: env.CS_TELEMETRY_URL || product.telemetryEndpoint || "https://v1.telemetry.coder.com/track",
});
}

11 changes: 4 additions & 7 deletions src/node/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -833,8 +833,8 @@ export interface CodeArgs extends UserProvidedCodeArgs {
version: boolean
"without-connection-token"?: boolean
"without-browser-env-var"?: boolean
compatibility: string
log: string[] | undefined
compatibility?: string
log?: string[]
}

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

/**
* Convert our arguments to VS Code server arguments.
* Convert our arguments to equivalent VS Code server arguments.
* Does not add any extra arguments.
*/
export const toCodeArgs = async (args: DefaultedArgs): Promise<CodeArgs> => {
return {
...args,
"accept-server-license-terms": true,
// This seems to be used to make the connection token flags optional (when
// set to 1.63) but we have always included them.
compatibility: "1.64",
/** Type casting. */
help: !!args.help,
version: !!args.version,
Expand Down
4 changes: 4 additions & 0 deletions src/node/routes/vscode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ export const ensureVSCodeLoaded = async (
try {
vscodeServer = await createVSServer(null, {
...(await toCodeArgs(req.args)),
"accept-server-license-terms": true,
// This seems to be used to make the connection token flags optional (when
// set to 1.63) but we have always included them.
compatibility: "1.64",
"without-connection-token": true,
})
} catch (error) {
Expand Down
2 changes: 0 additions & 2 deletions test/unit/node/cli.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -912,8 +912,6 @@ cert: false`)
describe("toCodeArgs", () => {
const vscodeDefaults = {
...defaults,
"accept-server-license-terms": true,
compatibility: "1.64",
help: false,
port: "8080",
version: false,
Expand Down

0 comments on commit c7fb1a9

Please sign in to comment.