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(server): address misleading statement
Elian Dorane7e2a0f651a4
diff --git a/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Scripting/Breaking changes/v0.104.0 Disabling the Node in.html b/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Scripting/Breaking changes/v0.104.0 Disabling the Node in.htmlindex b84c3891d8..190158e7f6 100644--- a/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Scripting/Breaking changes/v0.104.0 Disabling the Node in.html+++ b/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Scripting/Breaking changes/v0.104.0 Disabling the Node in.html@@ -37,10 +37,9 @@ class="admonition note"><codespellcheck="false">openExternal</code>is restricted to an allowlisted set of URL schemes(blocking <code spellcheck="false">file:</code>, <code spellcheck="false">smb:</code>,- Follina-class schemes, etc.), <code spellcheck="false">openPath</code> /+ Follina-class schemes, etc.), <code spellcheck="false">openPath</code> must+ resolve under the Trilium data directory or temporary directory, and<code- spellcheck="false">openFileUrl</code>must resolve under the Trilium data directory or temporary- directory, and <code spellcheck="false">downloadURL</code> is locked to the- app's own origin. Invalid input throws on the main side rather than being- silently passed through.</p>+ spellcheck="false">downloadURL</code>is locked to the app's own origin. Invalid input throws+ on the main side rather than being silently passed through.</p></div>\ No newline at end of filediff --git a/apps/server/src/assets/llm/skills/frontend_scripting.md b/apps/server/src/assets/llm/skills/frontend_scripting.mdindex d9be5f107d..70cc1c2a00 100644--- a/apps/server/src/assets/llm/skills/frontend_scripting.md+++ b/apps/server/src/assets/llm/skills/frontend_scripting.md@@ -262,7 +262,8 @@ window.electronApi?.clipboard.copyImageToClipboard(bytes);Every `shell.*` call is validated in the main process and will throw on invalid input — the renderer is treated as untrusted:- `openExternal(url)`: scheme is allowlisted. `file:`, `data:`, `smb:`, `ldap:`/`ldaps:`, `jar:`, `view-source:`, and Follina-class schemes are blocked.-- `openPath(path)` / `openFileUrl(fileUrl)`: must resolve under the Trilium data dir or tmp dir. Returns an empty string on success, an error message on failure. UNC `file://host/share` URLs are blocked (NTLM-leak prevention).+- `openPath(path)`: must resolve under the Trilium data dir or tmp dir. Returns an empty string on success, an error message on failure.+- `openFileUrl(fileUrl)`: handles user-clicked `file:` links inside notes; resolves to any local path (no data/tmp sandbox — these links routinely point at arbitrary user documents). UNC `file://host/share` URLs are blocked (NTLM-leak prevention). Returns an empty string on success, an error message on failure.- `downloadURL(url)`: pinned to the app's own origin — cross-origin downloads are rejected.- `openCustom(filePath)`: must be a descendant of the tmp dir and the file must exist.diff --git a/docs/User Guide/User Guide/Scripting/Breaking changes/v0.104.0 Disabling the Node in.md b/docs/User Guide/User Guide/Scripting/Breaking changes/v0.104.0 Disabling the Node in.mdindex 1e7514ac6f..3dbe4092f7 100644--- a/docs/User Guide/User Guide/Scripting/Breaking changes/v0.104.0 Disabling the Node in.md+++ b/docs/User Guide/User Guide/Scripting/Breaking changes/v0.104.0 Disabling the Node in.md@@ -29,4 +29,4 @@ window.electronApi?.window.setZoomFactor(1.2);Some of the APIs have additional safe-guards built in which prevent unauthorized access.-The `shell` group is the most heavily validated: `openExternal` is restricted to an allowlisted set of URL schemes (blocking `file:`, `smb:`, Follina-class schemes, etc.), `openPath` / `openFileUrl` must resolve under the Trilium data directory or temporary directory, and `downloadURL` is locked to the app's own origin. Invalid input throws on the main side rather than being silently passed through.\ No newline at end of file+The `shell` group is the most heavily validated: `openExternal` is restricted to an allowlisted set of URL schemes (blocking `file:`, `smb:`, Follina-class schemes, etc.), `openPath` must resolve under the Trilium data directory or temporary directory, and `downloadURL` is locked to the app's own origin. Invalid input throws on the main side rather than being silently passed through.\ No newline at end of filediff --git a/packages/commons/src/lib/electron_api_interface.ts b/packages/commons/src/lib/electron_api_interface.tsindex f3779655e1..b62054146c 100644--- a/packages/commons/src/lib/electron_api_interface.ts+++ b/packages/commons/src/lib/electron_api_interface.ts@@ -231,17 +231,24 @@ export interface ElectronShellApi {openPath(path: string): Promise<string>;/**- * Opens a `file://` URL with its default OS handler. Convenience wrapper- * that decodes the URL before delegating to {@link openPath}.+ * Opens a `file://` URL with its default OS handler. Exists as a separate+ * channel from {@link openExternal} because Electron's `shell.openExternal`+ * mishandles Unicode characters in `file:` URLs on Windows; converting to+ * a filesystem path and calling `shell.openPath` works correctly.** **Security:** the URL must use the `file:` scheme and must have an* empty hostname. UNC paths (`file://attacker.example/share/x`) are* explicitly blocked because Windows would otherwise resolve them to* `\\attacker.example\share\x` and leak the user's NTLM hash via SMB* authentication. Drive-letter-as-host malformations like `file://C:/path`- * are normalized to `file:///C:/path` before parsing. After resolution- * the path is subject to the same data-dir / tmp-dir sandbox as- * {@link openPath}.+ * are normalized to `file:///C:/path` before parsing.+ *+ * Note: unlike {@link openPath}, the resolved path is NOT confined to the+ * Trilium data / tmp directories — this channel handles user-clicked+ * `file://` links inside note content, which routinely reference arbitrary+ * locations on disk (`file:///C:/Users/me/Documents/contract.pdf` and+ * similar). Equivalent to a browser following a `file:` link the user+ * clicked. Treat clicks on attacker-influenced note content accordingly.** @returns An empty string on success, or an error message on failure.*/