Skip to content

A local-first personal finance app

Fix: restrict electron-embedded sync server to bind only to configured hostname for security (#5050)

Shreyasd2d8ce2353a2
diff --git a/packages/desktop-electron/index.ts b/packages/desktop-electron/index.ts
index 4987b90dad..805dabc06f 100644
--- a/packages/desktop-electron/index.ts
+++ b/packages/desktop-electron/index.ts
@@ -219,6 +219,7 @@ async function startSyncServer() {
const syncServerConfig = {
port: globalPrefs.syncServerConfig?.port || 5007,
+ hostname: 'localhost',
ACTUAL_SERVER_DATA_DIR: path.resolve(
process.env.ACTUAL_DATA_DIR!,
'actual-server',
@@ -252,6 +253,7 @@ async function startSyncServer() {
const envVariables: Env = {
...process.env, // required
ACTUAL_PORT: `${syncServerConfig.port}`,
+ ACTUAL_HOSTNAME: `${syncServerConfig.hostname}`,
ACTUAL_SERVER_FILES: `${syncServerConfig.ACTUAL_SERVER_FILES}`,
ACTUAL_USER_FILES: `${syncServerConfig.ACTUAL_USER_FILES}`,
ACTUAL_DATA_DIR: `${syncServerConfig.ACTUAL_SERVER_DATA_DIR}`,
diff --git a/upcoming-release-notes/5050.md b/upcoming-release-notes/5050.md
new file mode 100644
index 0000000000..52a10ea4ec
--- /dev/null
+++ b/upcoming-release-notes/5050.md
@@ -0,0 +1,6 @@
+---
+category: Bugfix
+authors: [ShreyasKallingal]
+---
+
+Restrict Electron-embedded sync server to bind only to configured hostname.