- Notifications
You must be signed in to change notification settings - Fork1k
Add domain to Trusted Domain by default#19995
-
Not sure if this is a There is a command |
BetaWas this translation helpful?Give feedback.
All reactions
(This took half of my Saturday, hopefully someone finds this useful.)
VS Code Desktop
I have discovered environments using a Client configuration management tools can use:
sqlite3~/.config/Code/User/globalStorage/state.vscdb"UPDATE ItemTable SET value = '[\"https://github.com\",\"https://git.corp.example.com\",\"https://foorack.com\"]' WHERE key = 'http.linkProtectionTrustedDomains';"
This command needs to be run as each user / on each home folder, and only works for the Desktop installations of Code/Code - Insider/etc.
Warning
This willwipe any previously Developer-added domains each time the command is run. Only run itonce on initial-setup.
Coder / code-server
However, this does…
Replies: 3 comments
-
I have already tried setting There is "workbench.trustedDomains.promptInTrustedWorkspace":false but it also has no impact, as I suspect the current workspace is not Trusted. Even when re-enabling workspace.trust.enabled to True, and making sure my current folder is trusted - |
BetaWas this translation helpful?Give feedback.
All reactions
-
Relatedmicrosoft/vscode#82794 |
BetaWas this translation helpful?Give feedback.
All reactions
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
(This took half of my Saturday, hopefully someone finds this useful.) VS Code DesktopI have discovered environments using a Client configuration management tools can use: sqlite3~/.config/Code/User/globalStorage/state.vscdb"UPDATE ItemTable SET value = '[\"https://github.com\",\"https://git.corp.example.com\",\"https://foorack.com\"]' WHERE key = 'http.linkProtectionTrustedDomains';" This command needs to be run as each user / on each home folder, and only works for the Desktop installations of Code/Code - Insider/etc. Warning This willwipe any previously Developer-added domains each time the command is run. Only run itonce on initial-setup. Coder / code-serverHowever, this does not work for There is a patch to add I spent a lot of time trying to get this patched in but struggled to see the commandline argument have an effect. However, I think this is due to "example.com,example.net" being treated as one value instead of a string-array corrupting things. After a lot of cleanup I made the following PR to upstream this feature: Finally, also sharing this shorter-term but immediately-working solution: resource"coder_agent""main" {arch=data.coder_provisioner.me.archos="linux"dir="/home/coder/${local.folder_name}"# Add any commands that should be executed at workspace startup (e.g install requirements, start a program, etc) herestartup_script=<<-EOT # # CORE SETUP # # Update code-server trusted domains echo "🔧 Updating code-server trusted domains..." mkdir -p /tmp/code-server/lib while [ ! -f "$(find /tmp/code-server/lib/ -type f -name 'product.json' | head -n1)" ]; do :; done CODE_SERVER_PROFILE_JSON="$(find /tmp/code-server/lib/ -type f -name 'product.json' | head -n1)" cat $CODE_SERVER_PROFILE_JSON | jq '.linkProtectionTrustedDomains = ["https://open-vsx.org","https://github.com","https://git.corp.example.com","https://foorack.com","*.amazonaws.com"]' > /tmp/product-modified.json mv /tmp/product-modified.json $CODE_SERVER_PROFILE_JSON # # REST OF YOUR startup_script, LIKE SKEL HOME, INSTALLING TOOLS, ETC. #[...] Caution REMEMBER TO KEEP Tip Please add the "product.json-override" logic at the very top of the Despite the minor race-requirement, I think this solution is elegant in that it doesn't override the users own value. Unlike the Desktop approach, this actually allows the developer to add additional domains, while allowing the core configuration to be enforced at any time. |
BetaWas this translation helpful?Give feedback.