Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
chore(options): tweak layout of security page
Elian Doran17d19870e6bb
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.jsonindex 9268d051fb..b13e8e15f0 100644--- a/apps/client/src/translations/en/translation.json+++ b/apps/client/src/translations/en/translation.json@@ -1570,10 +1570,12 @@"options_change_saved": "Options change have been saved."},"security": {- "scripting_title": "Scripting",- "scripting_warning": "Backend scripts have full server access including filesystem, network, and OS commands. Only enable if you trust all sync peers and imported content.",+ "backend_scripting_title": "Backend scripting",+ "backend_scripting_section_description": "Backend scripts have full server access including filesystem, network, and OS commands. They can be triggered via sync, import, or any content that includes executable attributes. Frontend scripts are always enabled as they run in a sandboxed browser context.","backend_scripting_label": "Backend script execution",- "backend_scripting_description": "Allow execution of backend scripts (startup scripts, custom request handlers, event handlers, etc.).",+ "backend_scripting_description": "Allow execution of backend scripts (startup scripts, custom request handlers, event handlers, scheduled scripts, etc.).",+ "sql_console_title": "SQL console",+ "sql_console_section_description": "The SQL console allows running raw SQL queries against the database. This can be used to read sensitive data (e.g. sync secrets, API keys) and alter or delete any data. A malicious frontend script could also access the SQL console API programmatically.","sql_console_label": "SQL console","sql_console_description": "Allow execution of queries in the SQL console."},diff --git a/apps/client/src/widgets/type_widgets/options/security.tsx b/apps/client/src/widgets/type_widgets/options/security.tsxindex 96e7ae2c46..9c73c92b8a 100644--- a/apps/client/src/widgets/type_widgets/options/security.tsx+++ b/apps/client/src/widgets/type_widgets/options/security.tsx@@ -1,29 +1,26 @@import { t } from "../../../services/i18n";-import Admonition from "../../react/Admonition";import { OptionsRowWithToggle } from "./components/OptionsRow";import OptionsSection from "./components/OptionsSection";export default function SecuritySettings() {return (<>- <ScriptingSettings />+ <BackendScriptingSettings />+ <SqlConsoleSettings /></>);}-function ScriptingSettings() {- // These are read-only for now — the actual toggle mechanism (IPC + native+function BackendScriptingSettings() {+ // Read-only for now — the actual toggle mechanism (IPC + native// dialog on desktop, config.ini on server) will be implemented separately.- // For now we display the current state from the server config.const backendScriptingEnabled = false;- const sqlConsoleEnabled = false;return (- <OptionsSection title={t("security.scripting_title")}>- <Admonition type="warning">- {t("security.scripting_warning")}- </Admonition>-+ <OptionsSection+ title={t("security.backend_scripting_title")}+ description={t("security.backend_scripting_section_description")}+ ><OptionsRowWithTogglename="backend-scripting-enabled"label={t("security.backend_scripting_label")}@@ -32,7 +29,18 @@ function ScriptingSettings() {onChange={() => {}}disabled={true}/>+ </OptionsSection>+ );+}++function SqlConsoleSettings() {+ const sqlConsoleEnabled = false;+ return (+ <OptionsSection+ title={t("security.sql_console_title")}+ description={t("security.sql_console_section_description")}+ ><OptionsRowWithTogglename="sql-console-enabled"label={t("security.sql_console_label")}