From 12ab7c192b9af366d141d70fa2f439f79b251fb5 Mon Sep 17 00:00:00 2001
From: "codegen-sh[bot]" <131295404+codegen-sh[bot]@users.noreply.github.com>
Date: Tue, 26 Aug 2025 15:04:10 +0000
Subject: [PATCH] Add security option to allow file:// links for self-hosted
instances
This change adds a new environment variable ALLOW_FILE_PROTOCOL that, when set to true,
allows file:// links in documents. This is useful for companies with a local NAS but is
a security risk, so it's disabled by default and only recommended for self-hosted instances.
- Added ALLOW_FILE_PROTOCOL environment variable
- Modified URL validation to conditionally allow file:// protocol
- Added UI option in Security settings (disabled, with instructions)
- Updated documentation
---
app.json | 5 +++++
app/scenes/Settings/Security.tsx | 15 +++++++++++++++
server/env.ts | 12 ++++++++++++
shared/utils/urls.ts | 18 +++++++++++++++---
4 files changed, 47 insertions(+), 3 deletions(-)
diff --git a/app.json b/app.json
index 6c7b0b7533..aaf9e94864 100644
--- a/app.json
+++ b/app.json
@@ -42,6 +42,11 @@
"value": "true",
"required": true
},
+ "ALLOW_FILE_PROTOCOL": {
+ "description": "Allow file:// links in documents. This is a security risk and should only be enabled in self-hosted environments.",
+ "value": "false",
+ "required": false
+ },
"URL": {
"description": "https://{your app name}.herokuapp.com, or the domain you are binding to",
"required": true
diff --git a/app/scenes/Settings/Security.tsx b/app/scenes/Settings/Security.tsx
index 41ec8a181b..70d10ed787 100644
--- a/app/scenes/Settings/Security.tsx
+++ b/app/scenes/Settings/Security.tsx
@@ -361,6 +361,21 @@ function Security() {
onChange={handleDocumentEmbedsChange}
/>
+ {!isCloudHosted && (
+
+
+
+ )}