Skip to content

Commit 6434946

Browse files
Merge pull request #754 from jiridanek/jd_diable_trust_prompt
RHOAIENG-14518: feat(codeserver): disable the VSCode workspace trust mechanism and the trust prompt
2 parents 1595213 + 2cdbe8a commit 6434946

File tree

2 files changed

+22
-10
lines changed

2 files changed

+22
-10
lines changed

codeserver/ubi9-python-3.11/run-code-server.sh

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ source ${SCRIPT_DIR}/utils/*.sh
88
run-nginx.sh &
99
/usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf &
1010

11-
# Add .bashrc for custom promt if not present
11+
# Add .bashrc for custom prompt if not present
1212
if [ ! -f "/opt/app-root/src/.bashrc" ]; then
1313
echo 'PS1="\[\033[34;1m\][\$(pwd)]\[\033[0m\]\n\[\033[1;0m\]$ \[\033[0m\]"' > /opt/app-root/src/.bashrc
1414
fi
@@ -42,16 +42,22 @@ create_dir_and_file() {
4242
# Define universal settings
4343
universal_dir="/opt/app-root/src/.local/share/code-server/User/"
4444
user_settings_filepath="${universal_dir}settings.json"
45-
universal_json_settings='{
45+
universal_json_settings='// vscode settings are written in json-with-comments
46+
/* https://code.visualstudio.com/docs/languages/json#_json-with-comments */
47+
{
4648
"python.defaultInterpreterPath": "/opt/app-root/bin/python3",
4749
"telemetry.telemetryLevel": "off",
4850
"telemetry.enableTelemetry": false,
4951
"workbench.enableExperiments": false,
5052
"extensions.autoCheckUpdates": false,
51-
"extensions.autoUpdate": false
53+
"extensions.autoUpdate": false,
54+
55+
// RHOAIENG-14518: Disable the "Do you trust the authors [...]" startup prompt
56+
"security.workspace.trust.enabled": false,
57+
"security.workspace.trust.startupPrompt": "never"
5258
}'
5359

54-
# Define python debuger settings
60+
# Define python debugger settings
5561
vscode_dir="/opt/app-root/src/.vscode/"
5662
settings_filepath="${vscode_dir}settings.json"
5763
launch_filepath="${vscode_dir}launch.json"
@@ -72,7 +78,7 @@ json_settings='{
7278
"python.defaultInterpreterPath": "/opt/app-root/bin/python3"
7379
}'
7480

75-
# Create necessary directories and files for python debuger and universal settings
81+
# Create necessary directories and files for python debugger and universal settings
7682
create_dir_and_file "$universal_dir" "$user_settings_filepath" "$universal_json_settings"
7783
create_dir_and_file "$vscode_dir" "$settings_filepath" "$json_settings"
7884
create_dir_and_file "$vscode_dir" "$launch_filepath" "$json_launch_settings"

codeserver/ubi9-python-3.9/run-code-server.sh

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ source ${SCRIPT_DIR}/utils/*.sh
88
run-nginx.sh &
99
/usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf &
1010

11-
# Add .bashrc for custom promt if not present
11+
# Add .bashrc for custom prompt if not present
1212
if [ ! -f "/opt/app-root/src/.bashrc" ]; then
1313
echo 'PS1="\[\033[34;1m\][\$(pwd)]\[\033[0m\]\n\[\033[1;0m\]$ \[\033[0m\]"' > /opt/app-root/src/.bashrc
1414
fi
@@ -42,16 +42,22 @@ create_dir_and_file() {
4242
# Define universal settings
4343
universal_dir="/opt/app-root/src/.local/share/code-server/User/"
4444
user_settings_filepath="${universal_dir}settings.json"
45-
universal_json_settings='{
45+
universal_json_settings='// vscode settings are written in json-with-comments
46+
/* https://code.visualstudio.com/docs/languages/json#_json-with-comments */
47+
{
4648
"python.defaultInterpreterPath": "/opt/app-root/bin/python3",
4749
"telemetry.telemetryLevel": "off",
4850
"telemetry.enableTelemetry": false,
4951
"workbench.enableExperiments": false,
5052
"extensions.autoCheckUpdates": false,
51-
"extensions.autoUpdate": false
53+
"extensions.autoUpdate": false,
54+
55+
// RHOAIENG-14518: Disable the "Do you trust the authors [...]" startup prompt
56+
"security.workspace.trust.enabled": false,
57+
"security.workspace.trust.startupPrompt": "never"
5258
}'
5359

54-
# Define python debuger settings
60+
# Define python debugger settings
5561
vscode_dir="/opt/app-root/src/.vscode/"
5662
settings_filepath="${vscode_dir}settings.json"
5763
launch_filepath="${vscode_dir}launch.json"
@@ -72,7 +78,7 @@ json_settings='{
7278
"python.defaultInterpreterPath": "/opt/app-root/bin/python3"
7379
}'
7480

75-
# Create necessary directories and files for python debuger and universal settings
81+
# Create necessary directories and files for python debugger and universal settings
7682
create_dir_and_file "$universal_dir" "$user_settings_filepath" "$universal_json_settings"
7783
create_dir_and_file "$vscode_dir" "$settings_filepath" "$json_settings"
7884
create_dir_and_file "$vscode_dir" "$launch_filepath" "$json_launch_settings"

0 commit comments

Comments
 (0)