Skip to content

Commit 36aac49

Browse files
authored
Merge branch 'main' into jsjoeio/external-uri
2 parents d763c1c + d4707d1 commit 36aac49

14 files changed

+51
-31
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
},
8686
"dependencies": {
8787
"@coder/logger": "^3.0.0",
88-
"argon2": "^0.29.0",
88+
"argon2": "^0.30.0",
8989
"compression": "^1.7.4",
9090
"cookie-parser": "^1.4.5",
9191
"env-paths": "^2.2.0",

src/node/cli.ts

+5
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ export interface UserProvidedCodeArgs {
5050
"github-auth"?: string
5151
"disable-update-check"?: boolean
5252
"disable-file-downloads"?: boolean
53+
"disable-workspace-trust"?: boolean
5354
}
5455

5556
/**
@@ -163,6 +164,10 @@ export const options: Options<Required<UserProvidedArgs>> = {
163164
description:
164165
"Disable file downloads from Code. This can also be set with CS_DISABLE_FILE_DOWNLOADS set to 'true' or '1'.",
165166
},
167+
"disable-workspace-trust": {
168+
type: "boolean",
169+
description: "Disable Workspace Trust feature. This switch only affects the current session.",
170+
},
166171
// --enable can be used to enable experimental features. These features
167172
// provide no guarantees.
168173
enable: { type: "string[]" },

test/e2e/codeServer.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { getMaybeProxiedCodeServer } from "../utils/helpers"
44
import { describe, test, expect } from "./baseFixture"
55
import { CodeServer } from "./models/CodeServer"
66

7-
describe("code-server", [], {}, () => {
7+
describe("code-server", ["--disable-workspace-trust"], {}, () => {
88
// TODO@asher: Generalize this? Could be nice if we were to ever need
99
// multiple migration tests in other suites.
1010
const instances = new Map<string, CodeServer>()

test/e2e/displayLang.test.ts

+13-8
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,17 @@ import { describe, test, expect } from "./baseFixture"
33

44
// Given a code-server environment with Spanish Language Pack extension installed
55
// and a languagepacks.json in the data-dir
6-
describe("--locale es", ["--extensions-dir", path.join(__dirname, "./extensions"), "--locale", "es"], {}, () => {
7-
test("should load code-server in Spanish", async ({ codeServerPage }) => {
8-
// When
9-
const visible = await codeServerPage.page.isVisible("text=Explorador")
6+
describe(
7+
"--locale es",
8+
["--disable-workspace-trust", "--extensions-dir", path.join(__dirname, "./extensions"), "--locale", "es"],
9+
{},
10+
() => {
11+
test("should load code-server in Spanish", async ({ codeServerPage }) => {
12+
// When
13+
const visible = await codeServerPage.page.isVisible("text=Explorador")
1014

11-
// Then
12-
expect(visible).toBe(true)
13-
})
14-
})
15+
// Then
16+
expect(visible).toBe(true)
17+
})
18+
},
19+
)

test/e2e/downloads.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as path from "path"
33
import { clean } from "../utils/helpers"
44
import { describe, test, expect } from "./baseFixture"
55

6-
describe("Downloads (enabled)", [], {}, async () => {
6+
describe("Downloads (enabled)", ["--disable-workspace-trust"], {}, async () => {
77
const testName = "downloads-enabled"
88
test.beforeAll(async () => {
99
await clean(testName)
@@ -25,7 +25,7 @@ describe("Downloads (enabled)", [], {}, async () => {
2525
})
2626
})
2727

28-
describe("Downloads (disabled)", ["--disable-file-downloads"], {}, async () => {
28+
describe("Downloads (disabled)", ["--disable-workspace-trust", "--disable-file-downloads"], {}, async () => {
2929
const testName = "downloads-disabled"
3030
test.beforeAll(async () => {
3131
await clean(testName)

test/e2e/extensions.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function runTestExtensionTests() {
1919
})
2020
}
2121

22-
const flags = ["--extensions-dir", path.join(__dirname, "./extensions")]
22+
const flags = ["--disable-workspace-trust", "--extensions-dir", path.join(__dirname, "./extensions")]
2323

2424
describe("Extensions", flags, {}, () => {
2525
runTestExtensionTests()

test/e2e/github.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { test as base } from "@playwright/test"
22
import { describe, expect, test } from "./baseFixture"
33

44
if (process.env.GITHUB_TOKEN) {
5-
describe("GitHub token", [], {}, () => {
5+
describe("GitHub token", ["--disable-workspace-trust"], {}, () => {
66
test("should be logged in to pull requests extension", async ({ codeServerPage }) => {
77
await codeServerPage.exec("git init")
88
await codeServerPage.exec("git remote add origin https://github.com/coder/code-server")
@@ -16,7 +16,7 @@ if (process.env.GITHUB_TOKEN) {
1616
})
1717
})
1818

19-
describe("No GitHub token", [], { GITHUB_TOKEN: "" }, () => {
19+
describe("No GitHub token", ["--disable-workspace-trust"], { GITHUB_TOKEN: "" }, () => {
2020
test("should not be logged in to pull requests extension", async ({ codeServerPage }) => {
2121
await codeServerPage.exec("git init")
2222
await codeServerPage.exec("git remote add origin https://github.com/coder/code-server")

test/e2e/login.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { PASSWORD } from "../utils/constants"
22
import { describe, test, expect } from "./baseFixture"
33

4-
describe("login", ["--auth", "password"], {}, () => {
4+
describe("login", ["--disable-workspace-trust", "--auth", "password"], {}, () => {
55
test("should see the login page", async ({ codeServerPage }) => {
66
// It should send us to the login page
77
expect(await codeServerPage.page.title()).toBe("code-server login")

test/e2e/logout.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// NOTE@jsjoeio commenting out until we can figure out what's wrong
22
// import { describe, test, expect } from "./baseFixture"
33

4-
// describe("logout", true, [], {}, () => {
4+
// describe("logout", true, ["--disable-workspace-trust"], {}, () => {
55
// test("should be able logout", async ({ codeServerPage }) => {
66
// // Recommended by Playwright for async navigation
77
// // https://github.com/microsoft/playwright/issues/1987#issuecomment-620182151

test/e2e/models/CodeServer.ts

-3
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,6 @@ export class CodeServer {
8282
path.join(dir, "User/settings.json"),
8383
JSON.stringify({
8484
"workbench.startupEditor": "none",
85-
// NOTE@jsjoeio - needed to prevent Trust Policy prompt
86-
// in end-to-end tests.
87-
"security.workspace.trust.enabled": false,
8885
}),
8986
"utf8",
9087
)

test/e2e/openHelpAbout.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { version } from "../../src/node/constants"
22
import { describe, test, expect } from "./baseFixture"
33

4-
describe("Open Help > About", [], {}, () => {
4+
describe("Open Help > About", ["--disable-workspace-trust"], {}, () => {
55
test("should see code-server version in about dialog", async ({ codeServerPage }) => {
66
// Open using the menu.
77
await codeServerPage.navigateMenus(["Help", "About"])

test/e2e/terminal.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import util from "util"
55
import { clean, getMaybeProxiedCodeServer, tmpdir } from "../utils/helpers"
66
import { describe, expect, test } from "./baseFixture"
77

8-
describe("Integrated Terminal", [], {}, () => {
8+
describe("Integrated Terminal", ["--disable-workspace-trust"], {}, () => {
99
const testName = "integrated-terminal"
1010
test.beforeAll(async () => {
1111
await clean(testName)

test/e2e/trust.test.ts

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { describe, test, expect } from "./baseFixture"
2+
3+
describe("Workspace trust (enabled)", [], {}, async () => {
4+
test("should see the 'I Trust...' option", async ({ codeServerPage }) => {
5+
expect(await codeServerPage.page.isVisible("text=Yes, I trust")).toBe(true)
6+
})
7+
})
8+
9+
describe("Workspace trust (disabled)", ["--disable-workspace-trust"], {}, async () => {
10+
test("should not see the 'I Trust...' option", async ({ codeServerPage }) => {
11+
expect(await codeServerPage.page.isVisible("text=Yes, I trust")).toBe(false)
12+
})
13+
})

yarn.lock

+9-9
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@
5757
resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-1.2.0.tgz#87de7af9c231826fdd68ac7258f77c429e0e5fcf"
5858
integrity sha512-wdppn25U8z/2yiaT6YGquE6X8sSv7hNMWSXYSSU1jGv/yd6XqjXgTDJ8KP4NgjTXfJ3GbRjeeb8RTV7a/VpM+w==
5959

60-
"@mapbox/node-pre-gyp@^1.0.9":
61-
version "1.0.9"
62-
resolved "https://registry.yarnpkg.com/@mapbox/node-pre-gyp/-/node-pre-gyp-1.0.9.tgz#09a8781a3a036151cdebbe8719d6f8b25d4058bc"
63-
integrity sha512-aDF3S3rK9Q2gey/WAttUlISduDItz5BU3306M9Eyv6/oS40aMprnopshtlKTykxRNIBEZuRMaZAnbrQ4QtKGyw==
60+
"@mapbox/node-pre-gyp@^1.0.10":
61+
version "1.0.10"
62+
resolved "https://registry.yarnpkg.com/@mapbox/node-pre-gyp/-/node-pre-gyp-1.0.10.tgz#8e6735ccebbb1581e5a7e652244cadc8a844d03c"
63+
integrity sha512-4ySo4CjzStuprMwk35H5pPbkymjv1SF3jGLj6rAHp/xT/RF7TL7bd9CTm1xDY49K2qF7jmR/g7k+SkLETP6opA==
6464
dependencies:
6565
detect-libc "^2.0.0"
6666
https-proxy-agent "^5.0.0"
@@ -489,12 +489,12 @@ arg@^4.1.0:
489489
resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089"
490490
integrity sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==
491491

492-
argon2@^0.29.0:
493-
version "0.29.1"
494-
resolved "https://registry.yarnpkg.com/argon2/-/argon2-0.29.1.tgz#e6b621ba5dcaf02ea8246669532c2934799973e3"
495-
integrity sha512-bWXzAsQA0B6EFWZh5li+YBk+muoknAb8KacAi1h/bC6Gigy9p5ANbrPvpnjTIb7i9I11/8Df6FeSxpJDK3vy4g==
492+
argon2@^0.30.0:
493+
version "0.30.1"
494+
resolved "https://registry.yarnpkg.com/argon2/-/argon2-0.30.1.tgz#7c719b27956553c7066a07583bc0a36f5b3ef9b5"
495+
integrity sha512-wJYS8ebn6zHZwv4/iOOdlW1KUuLdbyIyhGsT51j6d9l5cRrHQU8pl817ubAxNgnS1jrbW/NGwegN3YrV0d5jRg==
496496
dependencies:
497-
"@mapbox/node-pre-gyp" "^1.0.9"
497+
"@mapbox/node-pre-gyp" "^1.0.10"
498498
"@phc/format" "^1.0.0"
499499
node-addon-api "^5.0.0"
500500

0 commit comments

Comments
 (0)