Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,21 @@ If a required command fails or emits a warning from project code, fix it in the

## Lessons

- Use a platform-native Hiddify path in dependency status fixtures and assert
which file was selected. A Linux AppImage fixture on macOS only passed when
a real Hiddify app was installed on the developer's host (ADR 0141).

- A settings recovery fixture must compare with an ordinary load of the saved
settings. macOS normalizes the TUN name and DNS port on load, so comparing
with the immediate save result fails even when recovery succeeds (ADR 0142).

- A Finder-launched application can have a different PATH from the terminal.
Check both standard Homebrew prefixes for the OpenVPN CLI in the desktop,
and refresh the check on window focus after installation. Track CLI
presence separately from supported side-tunnel routing. Use the desktop's
candidate list for environment snapshots and remove the old collector's
`PathBuf` import when the list moves (ADR 0075).

- A path or a file that reaches the helper over IPC is attacker input, even
from the authorized user: the helper is root and the desktop is not. "Regular,
non-symlink file" is not trust. Check who can change the file and every
Expand Down
30 changes: 15 additions & 15 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ members = [
]

[workspace.package]
version = "6.3.0"
version = "6.3.1"
edition = "2021"
license = "MIT OR Apache-2.0"
rust-version = "1.88"
Expand Down
2 changes: 1 addition & 1 deletion apps/desktop/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@iran-split/desktop",
"version": "6.3.0",
"version": "6.3.1",
"private": true,
"type": "module",
"scripts": {
Expand Down
27 changes: 26 additions & 1 deletion apps/desktop/src/components/ClientRegistry.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { render, screen, within } from "@testing-library/react";
import { fireEvent, render, screen, within } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { beforeEach, describe, expect, it, vi } from "vitest";
import { desktop } from "../api/desktop";
Expand Down Expand Up @@ -367,6 +367,31 @@ describe("ClientRegistry profile picker", () => {
);
});

it("refreshes OpenVPN installation on focus and explains the macOS tunnel limitation", async () => {
useAppStore.setState({ boot: { platform: "macos" } as BootstrapResult });
vi.mocked(desktop.clientBinaryInstalled).mockResolvedValue(false);
render(<ClientRegistry />);

const card = within(screen.getByTestId("client-card-openvpn"));
const windscribe = within(screen.getByTestId("client-card-windscribe"));
expect(await card.findByText("OpenVPN CLI was not found.")).toBeVisible();
expect(
await windscribe.findByText("OpenVPN CLI was not found."),
).toBeVisible();

vi.mocked(desktop.clientBinaryInstalled).mockResolvedValue(true);
fireEvent.focus(window);

expect(await card.findByText("OpenVPN CLI is installed.")).toBeVisible();
expect(
await windscribe.findByText("OpenVPN CLI is installed."),
).toBeVisible();
expect(
card.getByText("BiFlow side tunnels are unavailable on macOS."),
).toBeVisible();
expect(card.queryByText("OpenVPN CLI was not found.")).toBeNull();
});

it.each([
["macos", "https://formulae.brew.sh/formula/openvpn"],
["linux", "https://openvpn.net/community-docs/installing-openvpn/"],
Expand Down
55 changes: 39 additions & 16 deletions apps/desktop/src/components/ClientRegistry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -417,17 +417,25 @@ function ClientCard({
// Side tunnels need a system binary the app cannot ship; surface a
// per-platform download link when it is missing.
const [binaryInstalled, setBinaryInstalled] = useState<boolean | null>(null);
const macosSideTunnel =
platform === "macos" && client.config.kind === "owned_side_tunnel";
useEffect(() => {
if (client.config.kind !== "owned_side_tunnel") return;
let cancelled = false;
desktop
.clientBinaryInstalled(client.preset)
.then((installed) => {
if (!cancelled) setBinaryInstalled(installed);
})
.catch(() => undefined);
let latestCheck = 0;
function checkInstallation() {
const check = ++latestCheck;
void desktop
.clientBinaryInstalled(client.preset)
.then((installed) => {
if (check === latestCheck) setBinaryInstalled(installed);
})
.catch(() => undefined);
}
checkInstallation();
window.addEventListener("focus", checkInstallation);
return () => {
cancelled = true;
latestCheck += 1;
window.removeEventListener("focus", checkInstallation);
};
}, [client.preset, client.config.kind]);

Expand Down Expand Up @@ -496,14 +504,29 @@ function ClientCard({
) : null}
</p>

{binaryInstalled === false ? (
<p className="mt-2 flex flex-wrap items-center gap-2 rounded-xl border border-amber-400/30 bg-amber-400/10 px-3 py-2 text-xs">
{t("binaryMissing")}
<DownloadLinkButton
spec={runtimeBinarySpec(spec.id) ?? spec}
platform={platform}
labelKey="downloadOpenVpn"
/>
{binaryInstalled === false || macosSideTunnel ? (
<p
className="mt-2 flex flex-wrap items-center gap-2 rounded-xl border border-amber-400/30 bg-amber-400/10 px-3 py-2 text-xs"
role="status"
>
{binaryInstalled === false ? (
<span>
{t(macosSideTunnel ? "openvpnCliMissing" : "binaryMissing")}
</span>
) : null}
{macosSideTunnel && binaryInstalled === true ? (
<span>{t("openvpnCliInstalled")}</span>
) : null}
{macosSideTunnel ? (
<span>{t("macosSideTunnelUnavailable")}</span>
) : null}
{binaryInstalled === false ? (
<DownloadLinkButton
spec={runtimeBinarySpec(spec.id) ?? spec}
platform={platform}
labelKey="downloadOpenVpn"
/>
) : null}
</p>
) : null}

Expand Down
7 changes: 7 additions & 0 deletions apps/desktop/src/i18n/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,10 @@ const resources = {
clientDetails: "Settings & pinned hosts",
pinSummary: "{{domains}} domains · {{ips}} IPs",
binaryMissing: "OpenVPN is not installed on this system.",
openvpnCliMissing: "OpenVPN CLI was not found.",
openvpnCliInstalled: "OpenVPN CLI is installed.",
macosSideTunnelUnavailable:
"BiFlow side tunnels are unavailable on macOS.",
allowDirectWhenDown: "If disconnected, allow direct (leaks real IP)",
openvpnProfile: "Config file",
chooseFile: "Choose file",
Expand Down Expand Up @@ -606,6 +610,9 @@ const resources = {
clientDetails: "تنظیمات و میزبان‌های سنجاق‌شده",
pinSummary: "{{domains}} دامنه · {{ips}} آی‌پی",
binaryMissing: "OpenVPN روی این سیستم نصب نیست.",
openvpnCliMissing: "نسخهٔ خط فرمان OpenVPN پیدا نشد.",
openvpnCliInstalled: "نسخهٔ خط فرمان OpenVPN نصب است.",
macosSideTunnelUnavailable: "تونل جانبی BiFlow روی macOS در دسترس نیست.",
allowDirectWhenDown: "اگر قطع بود، مستقیم برود (آی‌پی واقعی لو می‌رود)",
openvpnProfile: "فایل کانفیگ",
chooseFile: "انتخاب فایل",
Expand Down
15 changes: 11 additions & 4 deletions crates/iran-split-config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1062,8 +1062,12 @@ mod tests {
let path = directory.path().join("config.toml");
let store = store(&path);
let mut config = store.load_or_create().expect("create");
config.behavior.show_taskbar_speed = !config.behavior.show_taskbar_speed;
let saved = store.save(config, 0).expect("save");
let show_taskbar_speed = !config.behavior.show_taskbar_speed;
config.behavior.show_taskbar_speed = show_taskbar_speed;
store.save(config, 0).expect("save");
let expected = store.load().expect("read saved settings for this platform");
assert_eq!(expected.revision, 1);
assert_eq!(expected.behavior.show_taskbar_speed, show_taskbar_speed);
for (broken, cause) in [
(b"password = \"secret".as_slice(), "not_valid_toml"),
(b"\xff\xfe\x00".as_slice(), "not_text"),
Expand All @@ -1074,12 +1078,15 @@ mod tests {
let recovery = recovery.expect("recovered");
assert_eq!(recovery.cause, cause);
assert_eq!(recovery.source, RecoveredFrom::LastSaved);
assert_eq!(loaded, saved);
assert!(loaded == expected, "recovery must match an ordinary load");
assert_eq!(
fs::read(path.with_extension("toml.corrupt")).expect("kept"),
broken
);
assert_eq!(store.load().expect("load"), saved);
assert!(
store.load().expect("load") == expected,
"the next load must retain the recovered settings"
);
}
}

Expand Down
7 changes: 7 additions & 0 deletions docs/adr/0075-windscribe-openvpn-download.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ already had a profile still had no in-app path to OpenVPN.
instructions. On Windows it opens the official Community installer page.
- The amber "OpenVPN is not installed" banner always opens the OpenVPN
page, including on a Windscribe card.
- The desktop and environment snapshot check the standard Homebrew CLI paths
for Apple Silicon and Intel Macs independently of the app's launch PATH.
Under `/opt/homebrew` and `/usr/local`, discovery checks both
`opt/openvpn/sbin/openvpn` and `sbin/openvpn`.
Client cards refresh installation status when the window regains focus.
On macOS the card and environment findings describe side-tunnel support
separately from CLI presence. Homebrew discovery belongs to the desktop.
- The URL allowlist stays derived from the preset table; Windscribe reuses
the OpenVPN row so it cannot drift.
- Use `/usr/bin/open` on macOS, `xdg-open` on Linux, and the Windows shell
Expand Down
Binary file modified docs/screenshots/desktop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/screenshots/diagnostics.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/screenshots/mobile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/screenshots/settings-speed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 18 additions & 1 deletion e2e/primary-flows.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -645,13 +645,30 @@ test.describe("primary BiFlow flows", () => {
await row.getByRole("button", { name: /^OpenVPN/ }).click();
const card = page.getByTestId("client-card-openvpn");
await expect(
card.getByText("OpenVPN is not installed on this system."),
card.getByText(
platform === "macOS"
? "OpenVPN CLI was not found."
: "OpenVPN is not installed on this system.",
),
).toBeVisible();
await page.evaluate(() =>
sessionStorage.removeItem("client-download-test-url"),
);
await card.getByRole("button", { name: "Download OpenVPN" }).click();
await expect.poll(openedUrl).toBe(url);
if (platform === "macOS") {
await page.evaluate(() => {
sessionStorage.setItem("biflow-mock-openvpn-installed", "1");
window.dispatchEvent(new Event("focus"));
});
await expect(card.getByText("OpenVPN CLI is installed.")).toBeVisible();
await expect(
card.getByText("BiFlow side tunnels are unavailable on macOS."),
).toBeVisible();
await expect(card.getByText("OpenVPN CLI was not found.")).toHaveCount(
0,
);
}

await page.getByRole("button", { name: "Add client" }).click();
const happRow = page.getByTestId("client-catalog-happ");
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "iran-split-desktop-workspace",
"version": "6.3.0",
"version": "6.3.1",
"private": true,
"packageManager": "pnpm@9.0.1",
"engines": {
Expand Down
Loading
Loading