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(core): rename messages regarding kill switch
Elian Doran920e9e5b36ad
diff --git a/apps/server/src/assets/config-sample.ini b/apps/server/src/assets/config-sample.iniindex c1b3806af4..a91575b25a 100644--- a/apps/server/src/assets/config-sample.ini+++ b/apps/server/src/assets/config-sample.ini@@ -69,9 +69,10 @@ oauthIssuerName=oauthIssuerIcon=[Scripting]-# Enable backend/frontend script execution. WARNING: Scripts have full server access including+# Enable backend script execution. WARNING: Backend scripts have full server access including# filesystem, network, and OS commands via require('child_process'). Only enable if you trust# all users with admin-level access to the server.+# Frontend scripts are always allowed (they run in a sandboxed browser context).# Desktop builds override this to true automatically.enabled=falsediff --git a/apps/server/src/routes/custom.ts b/apps/server/src/routes/custom.tsindex fea247d25f..8a20086040 100644--- a/apps/server/src/routes/custom.ts+++ b/apps/server/src/routes/custom.ts@@ -8,7 +8,7 @@ import sql from "../services/sql.js";function handleRequest(req: Request, res: Response) {if (!isScriptingEnabled()) {- res.status(403).send("Script execution is disabled on this server.");+ res.status(403).send("Backend script execution is disabled on this server.");return;}diff --git a/apps/server/src/services/config.ts b/apps/server/src/services/config.tsindex 5b0fe521ab..0f8e5761a3 100644--- a/apps/server/src/services/config.ts+++ b/apps/server/src/services/config.ts@@ -140,7 +140,7 @@ export interface TriliumConfig {};/** Scripting and code execution configuration */Scripting: {- /** Whether backend/frontend script execution is enabled (default: false for server, true for desktop) */+ /** Whether backend script execution is enabled (default: false for server, true for desktop) */enabled: boolean;/** Whether the SQL console is accessible (default: false) */sqlConsoleEnabled: boolean;diff --git a/apps/server/src/services/scripting_guard.spec.ts b/apps/server/src/services/scripting_guard.spec.tsindex 586677c031..7adf607b73 100644--- a/apps/server/src/services/scripting_guard.spec.ts+++ b/apps/server/src/services/scripting_guard.spec.ts@@ -51,7 +51,7 @@ describe("scripting_guard", () => {const { assertScriptingEnabled } = await import("./scripting_guard.js");expect(() => assertScriptingEnabled()).toThrowError(- /Script execution is disabled/+ /Backend script execution is disabled/);});diff --git a/apps/server/src/services/scripting_guard.ts b/apps/server/src/services/scripting_guard.tsindex 4936b464e8..1e43352049 100644--- a/apps/server/src/services/scripting_guard.ts+++ b/apps/server/src/services/scripting_guard.ts@@ -2,15 +2,15 @@ import config from "./config.js";import { isElectron } from "./utils.js";/**- * Throws if scripting is disabled. Desktop (Electron) always allows scripting.+ * Throws if backend scripting is disabled. Desktop (Electron) always allows scripting.*/export function assertScriptingEnabled(): void {if (isElectron || config.Scripting.enabled) {return;}throw new Error(- "Script execution is disabled. Set [Scripting] enabled=true in config.ini or " +- "TRILIUM_SCRIPTING_ENABLED=true to enable. WARNING: Scripts have full server access."+ "Backend script execution is disabled. Set [Scripting] enabled=true in config.ini or " ++ "TRILIUM_SCRIPTING_ENABLED=true to enable. WARNING: Backend scripts have full server access.");}diff --git a/apps/server/src/share/content_renderer.ts b/apps/server/src/share/content_renderer.tsindex 161cb285fe..555f6769af 100644--- a/apps/server/src/share/content_renderer.ts+++ b/apps/server/src/share/content_renderer.ts@@ -199,7 +199,7 @@ function renderNoteContentInternal(note: SNote | BNote, renderArgs: RenderArgs)};// Check if the user has their own template.- // Skip user-provided EJS templates when scripting is disabled since EJS can execute arbitrary JS.+ // Skip user-provided EJS templates when backend scripting is disabled since EJS can execute arbitrary JS.if (note.hasRelation("shareTemplate") && isScriptingEnabled()) {// Get the template note and contentconst templateId = note.getRelation("shareTemplate")?.value;diff --git a/apps/server/src/www.ts b/apps/server/src/www.tsindex 715876539b..75f92804ce 100644--- a/apps/server/src/www.ts+++ b/apps/server/src/www.ts@@ -94,10 +94,10 @@ async function displayStartupMessage() {getLog().info(`💾 DB size: ${utils.formatSize(getDbSize() * 1024)}`);if (isScriptingEnabled()) {- getLog().info("WARNING: Script execution is ENABLED. Scripts have full server access including " ++ getLog().info("WARNING: Backend script execution is ENABLED. Backend scripts have full server access including " +"filesystem, network, and OS commands. Only enable in trusted environments.");} else {- getLog().info("Script execution is DISABLED. Set [Scripting] enabled=true in config.ini to enable.");+ getLog().info("Backend script execution is DISABLED. Set [Scripting] enabled=true in config.ini to enable.");}getLog().info("");diff --git a/packages/trilium-core/src/services/scripting_guard.ts b/packages/trilium-core/src/services/scripting_guard.tsindex 82fdaeffe2..f2d2fdfd52 100644--- a/packages/trilium-core/src/services/scripting_guard.ts+++ b/packages/trilium-core/src/services/scripting_guard.ts@@ -2,15 +2,15 @@ import config from "./config.js";import { isElectron } from "./utils/index.js";/**- * Throws if scripting is disabled. Desktop (Electron) always allows scripting.+ * Throws if backend scripting is disabled. Desktop (Electron) always allows scripting.*/export function assertScriptingEnabled(): void {if (isElectron() || config.Scripting.enabled) {return;}throw new Error(- "Script execution is disabled. Set [Scripting] enabled=true in config.ini or " +- "TRILIUM_SCRIPTING_ENABLED=true to enable. WARNING: Scripts have full server access."+ "Backend script execution is disabled. Set [Scripting] enabled=true in config.ini or " ++ "TRILIUM_SCRIPTING_ENABLED=true to enable. WARNING: Backend scripts have full server access.");}diff --git a/packages/trilium-core/src/services/search/services/search.ts b/packages/trilium-core/src/services/search/services/search.tsindex 47ca78766a..4a738ef939 100644--- a/packages/trilium-core/src/services/search/services/search.ts+++ b/packages/trilium-core/src/services/search/services/search.ts@@ -81,7 +81,7 @@ function searchFromRelation(note: BNote, relationName: string) {}if (!isScriptingEnabled()) {- log.info("Script-based search is disabled (scripting is not enabled).");+ log.info("Script-based search is disabled (backend scripting is not enabled).");return [];}diff --git a/packages/trilium-core/src/services/sync_update.ts b/packages/trilium-core/src/services/sync_update.tsindex 34974ec282..9193a5b039 100644--- a/packages/trilium-core/src/services/sync_update.ts+++ b/packages/trilium-core/src/services/sync_update.ts@@ -95,14 +95,14 @@ function updateNormalEntity(remoteEC: EntityChange, remoteEntityRow: EntityRow |preProcessContent(remoteEC, remoteEntityRow);- // When scripting is disabled, prefix dangerous attributes with 'disabled:'+ // When backend scripting is disabled, prefix dangerous attributes with 'disabled:'// Same pattern as safeImport in attributes.tsif (remoteEC.entityName === "attributes" && !isScriptingEnabled()) {const attrRow = remoteEntityRow as Record<string, unknown>;if (typeof attrRow.type === "string" && typeof attrRow.name === "string"&& !attrRow.isDeleted&& attributeService.isAttributeDangerous(attrRow.type, attrRow.name)) {- getLog().info(`Sync: disabling dangerous attribute '${attrRow.name}' (scripting is disabled)`);+ getLog().info(`Sync: disabling dangerous attribute '${attrRow.name}' (backend scripting is disabled)`);attrRow.name = `disabled:${attrRow.name}`;}}