Skip to content

Build your personal knowledge base with Trilium Notes

feat(options): start a page on security

Elian Doran955e7cc9f765
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json
index 6b17f59ff5..9268d051fb 100644
--- a/apps/client/src/translations/en/translation.json
+++ b/apps/client/src/translations/en/translation.json
@@ -1569,6 +1569,14 @@
"options_status": "Options status",
"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_label": "Backend script execution",
+ "backend_scripting_description": "Allow execution of backend scripts (startup scripts, custom request handlers, event handlers, etc.).",
+ "sql_console_label": "SQL console",
+ "sql_console_description": "Allow execution of queries in the SQL console."
+ },
"password": {
"heading": "Password",
"alert_message": "Please take care to remember your new password. Password is used for logging into the web interface and to encrypt protected notes. If you forget your password, then all your protected notes are forever lost.",
diff --git a/apps/client/src/widgets/type_widgets/ContentWidget.tsx b/apps/client/src/widgets/type_widgets/ContentWidget.tsx
index 06384bfe7d..e15bd47853 100644
--- a/apps/client/src/widgets/type_widgets/ContentWidget.tsx
+++ b/apps/client/src/widgets/type_widgets/ContentWidget.tsx
@@ -14,12 +14,13 @@ import SyncOptions from "./options/sync";
import OtherSettings from "./options/other";
import InternationalizationOptions from "./options/i18n";
import AdvancedSettings from "./options/advanced";
+import SecuritySettings from "./options/security";
import LlmSettings from "./options/llm";
import "./ContentWidget.css";
import { t } from "../../services/i18n";
import BackendLog from "./code/BackendLog";
-export type OptionPages = "_optionsAppearance" | "_optionsShortcuts" | "_optionsTextNotes" | "_optionsCodeNotes" | "_optionsMedia" | "_optionsSpellcheck" | "_optionsPassword" | "_optionsMFA" | "_optionsEtapi" | "_optionsBackup" | "_optionsSync" | "_optionsOther" | "_optionsLocalization" | "_optionsAdvanced" | "_optionsLlm";
+export type OptionPages = "_optionsAppearance" | "_optionsShortcuts" | "_optionsTextNotes" | "_optionsCodeNotes" | "_optionsMedia" | "_optionsSpellcheck" | "_optionsPassword" | "_optionsMFA" | "_optionsEtapi" | "_optionsBackup" | "_optionsSync" | "_optionsOther" | "_optionsLocalization" | "_optionsSecurity" | "_optionsAdvanced" | "_optionsLlm";
const CONTENT_WIDGETS: Record<OptionPages | "_backendLog", (props: TypeWidgetProps) => JSX.Element> = {
_optionsAppearance: AppearanceSettings,
@@ -35,6 +36,7 @@ const CONTENT_WIDGETS: Record<OptionPages | "_backendLog", (props: TypeWidgetPro
_optionsSync: SyncOptions,
_optionsOther: OtherSettings,
_optionsLocalization: InternationalizationOptions,
+ _optionsSecurity: SecuritySettings,
_optionsAdvanced: AdvancedSettings,
_optionsLlm: LlmSettings,
_backendLog: BackendLog
diff --git a/apps/client/src/widgets/type_widgets/options/security.tsx b/apps/client/src/widgets/type_widgets/options/security.tsx
new file mode 100644
index 0000000000..96e7ae2c46
--- /dev/null
+++ b/apps/client/src/widgets/type_widgets/options/security.tsx
@@ -0,0 +1,46 @@
+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 />
+ </>
+ );
+}
+
+function ScriptingSettings() {
+ // These are 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>
+
+ <OptionsRowWithToggle
+ name="backend-scripting-enabled"
+ label={t("security.backend_scripting_label")}
+ description={t("security.backend_scripting_description")}
+ currentValue={backendScriptingEnabled}
+ onChange={() => {}}
+ disabled={true}
+ />
+
+ <OptionsRowWithToggle
+ name="sql-console-enabled"
+ label={t("security.sql_console_label")}
+ description={t("security.sql_console_description")}
+ currentValue={sqlConsoleEnabled}
+ onChange={() => {}}
+ disabled={true}
+ />
+ </OptionsSection>
+ );
+}
diff --git a/apps/server/src/assets/translations/en/server.json b/apps/server/src/assets/translations/en/server.json
index 0ed268d3a1..8f50b7ce0a 100644
--- a/apps/server/src/assets/translations/en/server.json
+++ b/apps/server/src/assets/translations/en/server.json
@@ -324,6 +324,7 @@
"code-notes-title": "Code Notes",
"images-title": "Media",
"spellcheck-title": "Spellcheck",
+ "security-title": "Security",
"password-title": "Password",
"multi-factor-authentication-title": "MFA",
"etapi-title": "ETAPI",
diff --git a/packages/trilium-core/src/services/hidden_subtree.ts b/packages/trilium-core/src/services/hidden_subtree.ts
index 5b414a2bbb..eaa0812c70 100644
--- a/packages/trilium-core/src/services/hidden_subtree.ts
+++ b/packages/trilium-core/src/services/hidden_subtree.ts
@@ -302,6 +302,7 @@ function buildHiddenSubtreeDefinition(helpSubtree: HiddenSubtreeItem[]): HiddenS
{ id: "_optionsImages", title: "Images", type: "contentWidget", enforceDeleted: true },
{ id: "_optionsMedia", title: t("hidden-subtree.images-title"), type: "contentWidget", icon: "bx-image" },
{ id: "_optionsSpellcheck", title: t("hidden-subtree.spellcheck-title"), type: "contentWidget", icon: "bx-check-double" },
+ { id: "_optionsSecurity", title: t("hidden-subtree.security-title"), type: "contentWidget", icon: "bx-shield" },
{ id: "_optionsPassword", title: t("hidden-subtree.password-title"), type: "contentWidget", icon: "bx-lock" },
{ id: '_optionsMFA', title: t('hidden-subtree.multi-factor-authentication-title'), type: 'contentWidget', icon: 'bx-lock ' },
{ id: "_optionsEtapi", title: t("hidden-subtree.etapi-title"), type: "contentWidget", icon: "bx-extension" },