From 2cdbe8a4bd2e3d267e2b637ff45dc0da0602c45e Mon Sep 17 00:00:00 2001 From: Jiri Danek Date: Fri, 25 Oct 2024 12:24:42 +0200 Subject: [PATCH] RHOAIENG-14518: feat(codeserver): disable the VSCode workspace trust mechanism and the trust prompt --- codeserver/ubi9-python-3.11/run-code-server.sh | 16 +++++++++++----- codeserver/ubi9-python-3.9/run-code-server.sh | 16 +++++++++++----- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/codeserver/ubi9-python-3.11/run-code-server.sh b/codeserver/ubi9-python-3.11/run-code-server.sh index 96400da72..5e4652c02 100755 --- a/codeserver/ubi9-python-3.11/run-code-server.sh +++ b/codeserver/ubi9-python-3.11/run-code-server.sh @@ -8,7 +8,7 @@ source ${SCRIPT_DIR}/utils/*.sh run-nginx.sh & /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf & -# Add .bashrc for custom promt if not present +# Add .bashrc for custom prompt if not present if [ ! -f "/opt/app-root/src/.bashrc" ]; then echo 'PS1="\[\033[34;1m\][\$(pwd)]\[\033[0m\]\n\[\033[1;0m\]$ \[\033[0m\]"' > /opt/app-root/src/.bashrc fi @@ -42,16 +42,22 @@ create_dir_and_file() { # Define universal settings universal_dir="/opt/app-root/src/.local/share/code-server/User/" user_settings_filepath="${universal_dir}settings.json" -universal_json_settings='{ +universal_json_settings='// vscode settings are written in json-with-comments +/* https://code.visualstudio.com/docs/languages/json#_json-with-comments */ +{ "python.defaultInterpreterPath": "/opt/app-root/bin/python3", "telemetry.telemetryLevel": "off", "telemetry.enableTelemetry": false, "workbench.enableExperiments": false, "extensions.autoCheckUpdates": false, - "extensions.autoUpdate": false + "extensions.autoUpdate": false, + + // RHOAIENG-14518: Disable the "Do you trust the authors [...]" startup prompt + "security.workspace.trust.enabled": false, + "security.workspace.trust.startupPrompt": "never" }' -# Define python debuger settings +# Define python debugger settings vscode_dir="/opt/app-root/src/.vscode/" settings_filepath="${vscode_dir}settings.json" launch_filepath="${vscode_dir}launch.json" @@ -72,7 +78,7 @@ json_settings='{ "python.defaultInterpreterPath": "/opt/app-root/bin/python3" }' -# Create necessary directories and files for python debuger and universal settings +# Create necessary directories and files for python debugger and universal settings create_dir_and_file "$universal_dir" "$user_settings_filepath" "$universal_json_settings" create_dir_and_file "$vscode_dir" "$settings_filepath" "$json_settings" create_dir_and_file "$vscode_dir" "$launch_filepath" "$json_launch_settings" diff --git a/codeserver/ubi9-python-3.9/run-code-server.sh b/codeserver/ubi9-python-3.9/run-code-server.sh index 96400da72..5e4652c02 100755 --- a/codeserver/ubi9-python-3.9/run-code-server.sh +++ b/codeserver/ubi9-python-3.9/run-code-server.sh @@ -8,7 +8,7 @@ source ${SCRIPT_DIR}/utils/*.sh run-nginx.sh & /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf & -# Add .bashrc for custom promt if not present +# Add .bashrc for custom prompt if not present if [ ! -f "/opt/app-root/src/.bashrc" ]; then echo 'PS1="\[\033[34;1m\][\$(pwd)]\[\033[0m\]\n\[\033[1;0m\]$ \[\033[0m\]"' > /opt/app-root/src/.bashrc fi @@ -42,16 +42,22 @@ create_dir_and_file() { # Define universal settings universal_dir="/opt/app-root/src/.local/share/code-server/User/" user_settings_filepath="${universal_dir}settings.json" -universal_json_settings='{ +universal_json_settings='// vscode settings are written in json-with-comments +/* https://code.visualstudio.com/docs/languages/json#_json-with-comments */ +{ "python.defaultInterpreterPath": "/opt/app-root/bin/python3", "telemetry.telemetryLevel": "off", "telemetry.enableTelemetry": false, "workbench.enableExperiments": false, "extensions.autoCheckUpdates": false, - "extensions.autoUpdate": false + "extensions.autoUpdate": false, + + // RHOAIENG-14518: Disable the "Do you trust the authors [...]" startup prompt + "security.workspace.trust.enabled": false, + "security.workspace.trust.startupPrompt": "never" }' -# Define python debuger settings +# Define python debugger settings vscode_dir="/opt/app-root/src/.vscode/" settings_filepath="${vscode_dir}settings.json" launch_filepath="${vscode_dir}launch.json" @@ -72,7 +78,7 @@ json_settings='{ "python.defaultInterpreterPath": "/opt/app-root/bin/python3" }' -# Create necessary directories and files for python debuger and universal settings +# Create necessary directories and files for python debugger and universal settings create_dir_and_file "$universal_dir" "$user_settings_filepath" "$universal_json_settings" create_dir_and_file "$vscode_dir" "$settings_filepath" "$json_settings" create_dir_and_file "$vscode_dir" "$launch_filepath" "$json_launch_settings"