Skip to content

Commit a8e2364

Browse files
bpmctDevelopmentCatsmatifali
authored
feat: add option to disable VS Code Web workspace trust protection (#131)
for admins with certainty about what is installed in the environment, this is ideal. otherwise, it's best to get user trust --------- Co-authored-by: DevelopmentCats <[email protected]> Co-authored-by: Atif Ali <[email protected]>
1 parent 960ec18 commit a8e2364

File tree

3 files changed

+20
-7
lines changed

3 files changed

+20
-7
lines changed

registry/coder/modules/vscode-web/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Automatically install [Visual Studio Code Server](https://code.visualstudio.com/
1515
module "vscode-web" {
1616
count = data.coder_workspace.me.start_count
1717
source = "registry.coder.com/coder/vscode-web/coder"
18-
version = "1.2.0"
18+
version = "1.3.0"
1919
agent_id = coder_agent.example.id
2020
accept_license = true
2121
}
@@ -31,7 +31,7 @@ module "vscode-web" {
3131
module "vscode-web" {
3232
count = data.coder_workspace.me.start_count
3333
source = "registry.coder.com/coder/vscode-web/coder"
34-
version = "1.2.0"
34+
version = "1.3.0"
3535
agent_id = coder_agent.example.id
3636
install_prefix = "/home/coder/.vscode-web"
3737
folder = "/home/coder"
@@ -45,7 +45,7 @@ module "vscode-web" {
4545
module "vscode-web" {
4646
count = data.coder_workspace.me.start_count
4747
source = "registry.coder.com/coder/vscode-web/coder"
48-
version = "1.2.0"
48+
version = "1.3.0"
4949
agent_id = coder_agent.example.id
5050
extensions = ["github.copilot", "ms-python.python", "ms-toolsai.jupyter"]
5151
accept_license = true
@@ -60,7 +60,7 @@ Configure VS Code's [settings.json](https://code.visualstudio.com/docs/getstarte
6060
module "vscode-web" {
6161
count = data.coder_workspace.me.start_count
6262
source = "registry.coder.com/coder/vscode-web/coder"
63-
version = "1.2.0"
63+
version = "1.3.0"
6464
agent_id = coder_agent.example.id
6565
extensions = ["dracula-theme.theme-dracula"]
6666
settings = {
@@ -78,7 +78,7 @@ By default, this module installs the latest. To pin a specific version, retrieve
7878
module "vscode-web" {
7979
count = data.coder_workspace.me.start_count
8080
source = "registry.coder.com/coder/vscode-web/coder"
81-
version = "1.2.0"
81+
version = "1.3.0"
8282
agent_id = coder_agent.example.id
8383
commit_id = "e54c774e0add60467559eb0d1e229c6452cf8447"
8484
accept_license = true

registry/coder/modules/vscode-web/main.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,12 @@ variable "use_cached" {
121121
default = false
122122
}
123123

124+
variable "disable_trust" {
125+
type = bool
126+
description = "Disables workspace trust protection for VS Code Web."
127+
default = false
128+
}
129+
124130
variable "extensions_dir" {
125131
type = string
126132
description = "Override the directory to store extensions in."
@@ -169,6 +175,7 @@ resource "coder_script" "vscode-web" {
169175
SETTINGS : replace(jsonencode(var.settings), "\"", "\\\""),
170176
OFFLINE : var.offline,
171177
USE_CACHED : var.use_cached,
178+
DISABLE_TRUST : var.disable_trust,
172179
EXTENSIONS_DIR : var.extensions_dir,
173180
FOLDER : var.folder,
174181
AUTO_INSTALL_EXTENSIONS : var.auto_install_extensions,

registry/coder/modules/vscode-web/run.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,16 @@ if [ -n "${SERVER_BASE_PATH}" ]; then
1616
SERVER_BASE_PATH_ARG="--server-base-path=${SERVER_BASE_PATH}"
1717
fi
1818

19+
# Set disable workspace trust
20+
DISABLE_TRUST_ARG=""
21+
if [ "${DISABLE_TRUST}" = true ]; then
22+
DISABLE_TRUST_ARG="--disable-workspace-trust"
23+
fi
24+
1925
run_vscode_web() {
20-
echo "👷 Running $VSCODE_WEB serve-local $EXTENSION_ARG $SERVER_BASE_PATH_ARG --port ${PORT} --host 127.0.0.1 --accept-server-license-terms --without-connection-token --telemetry-level ${TELEMETRY_LEVEL} in the background..."
26+
echo "👷 Running $VSCODE_WEB serve-local $EXTENSION_ARG $SERVER_BASE_PATH_ARG $DISABLE_TRUST_ARG --port ${PORT} --host 127.0.0.1 --accept-server-license-terms --without-connection-token --telemetry-level ${TELEMETRY_LEVEL} in the background..."
2127
echo "Check logs at ${LOG_PATH}!"
22-
"$VSCODE_WEB" serve-local "$EXTENSION_ARG" "$SERVER_BASE_PATH_ARG" --port "${PORT}" --host 127.0.0.1 --accept-server-license-terms --without-connection-token --telemetry-level "${TELEMETRY_LEVEL}" > "${LOG_PATH}" 2>&1 &
28+
"$VSCODE_WEB" serve-local "$EXTENSION_ARG" "$SERVER_BASE_PATH_ARG" "$DISABLE_TRUST_ARG" --port "${PORT}" --host 127.0.0.1 --accept-server-license-terms --without-connection-token --telemetry-level "${TELEMETRY_LEVEL}" > "${LOG_PATH}" 2>&1 &
2329
}
2430

2531
# Check if the settings file exists...

0 commit comments

Comments
 (0)