From 7f431aba8b55ca11f3f550f85626d8bfad7677bf Mon Sep 17 00:00:00 2001 From: bluelovers Date: Wed, 27 May 2026 22:24:13 +0800 Subject: [PATCH] fix(ui): hide environment variable values and mask inputs as password (#284) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary - Display only environment variable names in instance info panel (hide values) - Display only environment variable names in logs view (hide values) - Change environment variable value inputs to password type in settings editor ## Motivation Environment variable values (which may contain sensitive data like API keys, tokens, or secrets) were displayed in plain text across multiple UI surfaces. This change: 1. **Reduces visual exposure** — instance info and logs view now show only variable names 2. **Masks input fields** — the settings editor uses `type="password"` for value inputs, preventing shoulder-surfing and accidental exposure in screenshots or screen recordings --------- Co-authored-by: Pascal André --- .../environment-variables-editor.tsx | 44 +++++++++++++-- packages/ui/src/components/instance-info.tsx | 6 +- packages/ui/src/components/logs-view.tsx | 12 ++-- .../ui/src/lib/i18n/messages/en/settings.ts | 3 + .../ui/src/lib/i18n/messages/es/settings.ts | 3 + .../ui/src/lib/i18n/messages/fr/settings.ts | 3 + .../ui/src/lib/i18n/messages/he/settings.ts | 3 + .../ui/src/lib/i18n/messages/ja/settings.ts | 3 + .../ui/src/lib/i18n/messages/ru/settings.ts | 3 + .../src/lib/i18n/messages/zh-Hans/settings.ts | 3 + packages/ui/src/stores/preferences.tsx | 56 ++++++++++++++++++- 11 files changed, 126 insertions(+), 13 deletions(-) diff --git a/packages/ui/src/components/environment-variables-editor.tsx b/packages/ui/src/components/environment-variables-editor.tsx index e8653ba0..ef5062b4 100644 --- a/packages/ui/src/components/environment-variables-editor.tsx +++ b/packages/ui/src/components/environment-variables-editor.tsx @@ -1,5 +1,5 @@ import { Component, createSignal, For, Show } from "solid-js" -import { Plus, Trash2, Key, Globe } from "lucide-solid" +import { Plus, Trash2, Key, Globe, Shield, ShieldOff } from "lucide-solid" import { useConfig } from "../stores/preferences" import { useI18n } from "../lib/i18n" @@ -14,10 +14,13 @@ const EnvironmentVariablesEditor: Component = ( addEnvironmentVariable, removeEnvironmentVariable, updateEnvironmentVariables, + isSecureEnvVar, + toggleSecureEnvVar, } = useConfig() const [envVars, setEnvVars] = createSignal>(serverSettings().environmentVariables || {}) const [newKey, setNewKey] = createSignal("") const [newValue, setNewValue] = createSignal("") + const [newVarSecure, setNewVarSecure] = createSignal(true) const entries = () => Object.entries(envVars()) @@ -27,10 +30,11 @@ const EnvironmentVariablesEditor: Component = ( if (!key) return - addEnvironmentVariable(key, value) + addEnvironmentVariable(key, value, newVarSecure()) setEnvVars({ ...envVars(), [key]: value }) setNewKey("") setNewValue("") + setNewVarSecure(true) } function handleRemoveVariable(key: string) { @@ -45,6 +49,10 @@ const EnvironmentVariablesEditor: Component = ( updateEnvironmentVariables(updated) } + function handleSecureToggle(key: string) { + toggleSecureEnvVar(key) + } + function handleKeyPress(e: KeyboardEvent) { if (e.key === "Enter" && !e.shiftKey) { e.preventDefault() @@ -81,14 +89,29 @@ const EnvironmentVariablesEditor: Component = ( title={t("envEditor.fields.name.readOnlyTitle")} /> handleUpdateVariable(key, e.currentTarget.value)} class="flex-1 px-2.5 py-1.5 text-sm bg-surface-base border border-base rounded text-primary focus-ring-accent disabled:opacity-50 disabled:cursor-not-allowed" placeholder={t("envEditor.fields.value.placeholder")} + autocomplete={isSecureEnvVar(key) ? "new-password" : "off"} + spellcheck={isSecureEnvVar(key) ? false : undefined} + autocapitalize={isSecureEnvVar(key) ? "off" : undefined} /> +