From 419290fce3ee6e6a9a1d1701e74d8b75dc70b018 Mon Sep 17 00:00:00 2001 From: Isaac Hill <71404865+isaachilly@users.noreply.github.com> Date: Fri, 23 Oct 2026 16:08:46 +0200 Subject: [PATCH 1/2] Allow extra connect-src vallues --- Framework/Backend/http/server.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Framework/Backend/http/server.js b/Framework/Backend/http/server.js index f55090bb8..b72c7b7e9 100644 --- a/Framework/Backend/http/server.js +++ b/Framework/Backend/http/server.js @@ -147,8 +147,9 @@ class HttpServer { * @param {list} config.iframeCsp list of URLs for frame-src CSP * @param {boolean} config.allow allow unsafe-eval in CSP * @param {boolean} config.allowIframeCsp allow iframe embedding from given URLs + * @param {list} [config.extraConnectSrc] sources appended to the default connect-src CSP */ - configureHelmet({ hostname, port, iframeCsp = [], allow = false, allowIframeCsp = false }) { + configureHelmet({ hostname, port, iframeCsp = [], allow = false, allowIframeCsp = false, extraConnectSrc = [] }) { // Sets "X-Frame-Options: DENY" (doesn't allow to be in any iframe) this.app.use(helmet.frameguard({ action: 'deny' })); // Sets "Strict-Transport-Security: max-age=5184000 (60 days) (stick to HTTPS) @@ -171,7 +172,8 @@ class HttpServer { ...(allowIframeCsp && { imgSrc: ["'self'", "data:", "blob:"] }), scriptSrc: ["'self'", ...(allow ? ["'unsafe-eval'"] : [])], styleSrc: ["'self'", "'unsafe-inline'"], - connectSrc: ["'self'", 'http://' + hostname + ':' + port, 'https://' + hostname, 'wss://' + hostname, 'ws://' + hostname + ':' + port], + connectSrc: ["'self'", 'http://' + hostname + ':' + port, 'https://' + hostname, 'wss://' + hostname, 'ws://' + hostname + ':' + port, + ...extraConnectSrc], upgradeInsecureRequests: null, frameSrc: iframeCsp /* eslint-enable */ From a352c6e3931f5102b5f118e131b7764cee9ce198 Mon Sep 17 00:00:00 2001 From: Isaac Hill <71404865+isaachilly@users.noreply.github.com> Date: Thu, 19 Nov 2026 15:10:46 +0100 Subject: [PATCH 2/2] Document CSP options in HttpServer JSDocs and md --- Framework/Backend/http/server.js | 2 +- Framework/docs/guide/http-server.md | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Framework/Backend/http/server.js b/Framework/Backend/http/server.js index b72c7b7e9..54cbd06d4 100644 --- a/Framework/Backend/http/server.js +++ b/Framework/Backend/http/server.js @@ -146,7 +146,7 @@ class HttpServer { * @param {number} config.port secure port number * @param {list} config.iframeCsp list of URLs for frame-src CSP * @param {boolean} config.allow allow unsafe-eval in CSP - * @param {boolean} config.allowIframeCsp allow iframe embedding from given URLs + * @param {boolean} config.allowIframeCsp allow blob: URLs in img-src (image previews/downloads) * @param {list} [config.extraConnectSrc] sources appended to the default connect-src CSP */ configureHelmet({ hostname, port, iframeCsp = [], allow = false, allowIframeCsp = false, extraConnectSrc = [] }) { diff --git a/Framework/docs/guide/http-server.md b/Framework/docs/guide/http-server.md index b8bed2252..ea5abfd7e 100644 --- a/Framework/docs/guide/http-server.md +++ b/Framework/docs/guide/http-server.md @@ -21,6 +21,10 @@ Where: * [`TLS_CERT`] - certificate filepath, TLS must be enabled * [`AUTO_LISTEN`] - flag that enables/disables automatic listening (default: `true`) * [`LIMIT`] - controls the maximum request body size. Defaults to '100kb'. + * [`iframeCsp`] - list of URLs allowed in the `frame-src` CSP directive (default: `[]`) + * [`allow`] - adds `'unsafe-eval'` to `script-src` (default: `false`) + * [`allowIframeCsp`] - adds `blob:` to `img-src` so blob-based images can be previewed/downloaded; despite the name, unrelated to iframes (default: `false`) + * [`extraConnectSrc`] - sources appended to the default `connect-src` CSP directive (default: `[]`) * [`JWT_CONF`] - JWT module config, see [JWT module](json-tokens.md) * [`OPENID_CONF`] - OpenID config, see [OpenID Connect module](openid.md)