Skip to content

Commit f0090c0

Browse files
security: gate lxma://test-* deep-link handlers behind #if DEBUG
The test-only URL handlers (test-call, test-send, test-identity-switch, test-restart, test-ble-*, etc.) were registered unconditionally in onOpenURL. In a release build that ships remote-control backdoors: a crafted lxma://test-call?to=HEX places a call, test-send sends a message from the user's identity, and test-identity-switch wipes the active identity — all from just opening a URL. Wrap the whole test block in #if DEBUG; the production lxma:// fall-through (pendingDeepLink) stays outside the guard, and the interop harness runs DEBUG builds so it's unaffected. (Smoke tests use a separate lxma-test:// surface.) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent e1de2ab commit f0090c0

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

Sources/ColumbaApp/App/ColumbaApp.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,15 @@ struct ColumbaApp: App {
7575
.id(ThemeManager.shared.themeVersion)
7676
.onOpenURL { url in
7777
guard url.scheme == "lxma" else { return }
78+
#if DEBUG
79+
// Test-only deep links — DEBUG builds ONLY. In a release build
80+
// these would be remote-control backdoors: a crafted
81+
// lxma://test-call / test-send / test-identity-switch URL could
82+
// place a call, send a message as the user, or wipe the active
83+
// identity with no interaction beyond opening the URL. The
84+
// interop test harness runs DEBUG builds, so it keeps them; the
85+
// production lxma:// deep-link fall-through (pendingDeepLink,
86+
// below) stays outside this guard.
7887
// Test trigger: lxma://test-send?to=HEX&content=...
7988
// bypasses the UI and directly invokes PythonRNSBackend.sendOpportunistic
8089
// so external scripts can exercise the Python round-trip during the smoke test.
@@ -345,6 +354,7 @@ struct ColumbaApp: App {
345354
)
346355
return
347356
}
357+
#endif
348358
pendingDeepLink = url.absoluteString
349359
}
350360
}

0 commit comments

Comments
 (0)