Skip to content

armgit / sure

Public Imported from GitHub
0

The personal finance app for everyone (by everyone)

Ruby

Let the macOS desktop app reach a server on the local network (#4843)

Krish Wanchooaeadccd1330e
diff --git a/desktop/README.md b/desktop/README.md
index c78ce9d5eb..7fb383bdef 100644
--- a/desktop/README.md
+++ b/desktop/README.md
@@ -37,12 +37,17 @@ only while building. The universal `.dmg` is attached to that same GitHub
Release—there is no separate desktop action, tag, or version.
## Installing an unsigned build (end users)
-The published `.dmg` is **not code-signed**, so macOS Gatekeeper blocks the first
-launch. To open it:
-1. Drag Sure to Applications and try to open it; dismiss the warning.
+The published `.dmg` is only ad-hoc signed (no Developer ID, not notarized), so
+macOS Gatekeeper blocks the first launch. To open it:
+1. Drag Sure to Applications and open it from there, not from the mounted disk
+ image; dismiss the warning.
2. **System Settings → Privacy & Security**, scroll down, click **Open Anyway**,
and confirm. (On macOS 15 Sequoia the old right-click→Open shortcut is gone;
this Settings path is the way.)
+3. If your server is on your local network (for example `http://192.168.x.x:3000`),
+ click **Allow** when macOS asks whether Sure may find devices on your local
+ network. If you declined, turn Sure on under **System Settings → Privacy &
+ Security → Local Network**.
If macOS instead says the app is "damaged", the download was quarantined — strip
it once in Terminal:
@@ -101,6 +106,7 @@ No Apple Developer credentials are needed to build/run locally. To ship a
distributable, signed, notarized `.dmg`, add:
1. An **Apple Developer ID Application** certificate in your login keychain.
2. Tauri signing config in `src-tauri/tauri.conf.json` under `bundle.macOS`:
+ replace the ad-hoc `"signingIdentity": "-"` with
`"signingIdentity": "Developer ID Application: <NAME> (<TEAMID>)"`,
`"hardenedRuntime": true`, and an `entitlements` plist if needed.
3. Notarization after build:
diff --git a/desktop/src-tauri/Info.plist b/desktop/src-tauri/Info.plist
new file mode 100644
index 0000000000..f52949032c
--- /dev/null
+++ b/desktop/src-tauri/Info.plist
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<!-- Merged by Tauri into the app bundle's Info.plist. -->
+<plist version="1.0">
+<dict>
+ <!-- macOS asks for Local Network access before the app can reach a
+ self-hosted server on a LAN address; without this key it is refused. -->
+ <key>NSLocalNetworkUsageDescription</key>
+ <string>Sure connects to your self-hosted Sure server on your local network.</string>
+</dict>
+</plist>
diff --git a/desktop/src-tauri/tauri.conf.json b/desktop/src-tauri/tauri.conf.json
index 65dd742fbf..001d568d59 100644
--- a/desktop/src-tauri/tauri.conf.json
+++ b/desktop/src-tauri/tauri.conf.json
@@ -45,7 +45,10 @@
"active": true,
"targets": ["app", "dmg"],
"icon": ["icons/icon.icns"],
- "category": "public.app-category.finance"
+ "category": "public.app-category.finance",
+ "macOS": {
+ "signingIdentity": "-"
+ }
},
"plugins": {
"deep-link": {
diff --git a/desktop/src-tauri/tests/config_test.rs b/desktop/src-tauri/tests/config_test.rs
index 0456b69271..b85e58be3e 100644
--- a/desktop/src-tauri/tests/config_test.rs
+++ b/desktop/src-tauri/tests/config_test.rs
@@ -17,3 +17,14 @@ fn local_webview_csp_is_enabled_and_restrictive() {
}
assert!(!csp.contains("connect-src *"));
}
+
+// macOS refuses LAN connections from an app that does not declare why it needs
+// the local network, and keeps no privacy permission for an unsigned bundle.
+#[test]
+fn macos_bundle_can_reach_a_server_on_the_local_network() {
+ let plist = include_str!("../Info.plist");
+ assert!(plist.contains("<key>NSLocalNetworkUsageDescription</key>"));
+
+ let config: Value = serde_json::from_str(include_str!("../tauri.conf.json")).unwrap();
+ assert_eq!(config["bundle"]["macOS"]["signingIdentity"], "-");
+}