Skip to content

Audit and test per-account VPN routing across Core and clients (V1) - #2149

Open
Th0rgal wants to merge 7 commits into
masterfrom
roadmap/v1-account-vpn-audit
Open

Th0rgal wants to merge 7 commits into
masterfrom
roadmap/v1-account-vpn-audit

Conversation

@Th0rgal

@Th0rgal Th0rgal commented Nov 23, 2026 •

Copy link
Copy Markdown
Owner

Roadmap row V1: audit, test and fix per-account AirVPN/Direct routing across Core, the sidecar, the harnesses and the clients.

What changed

  • One tested model for the account connection row. orb/src/accountVpn.ts owns every decision the row makes (selected country, offered list, editable, Confirm Direct, notice, status line, Retry, reread). iOS (OrbAccountVpn in OrbProvidersSettings.swift) and Android (OrbAccountVpn.kt) mirror it, and all three are checked against shared/orb-spec/fixtures/account-vpn.json.
  • Core defect 1 fixed: an upstream response could restate which account served a request. A provider response carrying X-Orb-Selected-Account, X-Orb-Route, X-Orb-Attempts-Used or another Core attribution header was forwarded ahead of Core's own value. Core now drops the upstream copy of the names it sets.
  • Core defect 2 fixed: a VPN tunnel that exited on its own made Core raise instead of answering. Once the first liveness check had collected the exit status of wireproxy, every later check raised. Reading the account's connection settings failed with an error, and so did retiring the tunnel. A tunnel whose status can no longer be read now counts as exited: Settings shows the route as blocked, the next request is refused before any provider is contacted, and the tunnel is retired and its relay connections revoked. No request went Direct before the fix; the route failed closed, but with an error instead of a reason.
  • Mobile caught up with desktop. iOS and Android previously: accepted any payload as a route; showed their own text for a credential that cannot be configured; had no fallback text for a blocked route (iOS); offered Retry while an exit was still being verified and never reread it; had no "Confirm Direct route" for native accounts; sorted the country list instead of keeping Core's order; had no message for an older Core; and Android did not explain a refused router change. Version 1.84.0 (2026112301) on both.

Behaviour change

While Core reports vpn_awaiting_verification, mobile now rereads the route every 5 s while the app is in the foreground and shows no Retry button, as desktop already did. Retry appears only after Core reports a failure.

Audit

One line per behaviour in the row. "new" marks a test added here.

Behaviour Core, sidecar, harness Web (WebKit and --leanui-hybrid) iOS / Android
Direct and country selection AirVpnSettingsTests: "legacy Direct route", "explicit Direct on legacy account", "enable VPN for one account", "direct clears VPN selection"; route contract in ProviderContractTests account-vpn-settings.test.tsx (6 tests); new account-vpn-model.test.tsx; account-vpn.browser.spec.ts in light and dark new testAccountConnectionMatchesSharedFixture / accountConnectionMatchesSharedFixture (was a gap)
Verified exit display new "verified route names its server and both exits" (was a gap) "saves only the expanded account…"; fixture case "verified country exit" same fixture tests
Disjoint same-category exits test_airvpn_wireguard.py (routes["a"] != routes["b"]); "same-category overlap across independent file handles"; admission_preserves_isolation fixture case "exit reserved by another account in the category" same fixture tests
Cross-category sharing within budget test_airvpn_wireguard.py (routes["c"] in …, max(max_sessions) == 5); "cross-category VPN lease"; other_categories_allow_sharing, reservation_within_budget server-side only server-side only
Relay drop, 0 direct requests test_airvpn_sidecar.py (len(recorded) == before); AccountVpnRelayTests; new "exited tunnel is refused, revoked and retired" server-side only server-side only
Restart persistence test_airvpn_wireguard.py crash and resume passes ("wireproxy survived Core SIGKILL") server-side only server-side only
X-Orb-Selected-Account existing SelfTest checks; new "upstream headers must not shadow Core attribution" no client reads the header no client reads the header
Alternative-router exclusion test_airvpn_sidecar.py set_google_exclusions; "A restricted Antigravity account must stay out of explicit and fallback proxy chains" browser spec; router cases in account-vpn-model.test.tsx new testAccountSettingReadErrorsAndRouterAccessMatchSharedFixture / accountSettingReadErrorsAndRouterAccessMatchSharedFixture (was a gap)
Disabled-account deduplication "R26 sidecar: disabled Core row with disabled on-disk auth file must appear once…"; "A disabled selected account must not resolve another login" clients render Core's list as sent and do not merge accounts same

Result: 9 behaviours audited, 4 gaps found and closed, 2 Core defects found and fixed, 1 gap left (pure LeanUI, below).

Each new test fails on the broken behaviour

  • Attribution header: before the fix, orb-core-test exited 1 with FAIL: upstream headers must not shadow Core attribution: served=acct-primary selected=#[spoofed, acct-primary] attempts=#[9, 1] route=#[spoofed, default]. After: exit 0.
  • Exited tunnel: before the fix, orb-managed-provider-test exited 1 with no such thing (error code: 10, no such process). After: exit 0.
  • Verified payload: with server replaced by the country, orb-managed-provider-test fails at "verified route names its server and both exits".
  • Web model: seven mutations of accountVpn.ts (Retry while pending, Confirm Direct ignoring saved, missing-endpoint ignoring the path, truthy router access, unknown mode accepted, editable when can_configure is absent, Direct write carrying a country) each fail account-vpn-model.test.tsx. The sixth survived at first and got its own fixture case.
  • Mobile model: commit ecabee3ac deliberately offered Retry while pending and treated any missing path as an older Core. On that head both Android tests failed (354 tests completed, 2 failed) and both iOS tests failed. The next commit restores the model. The squash removes the pair from history.

Local results

  • orb-core-test (hermetic, full): exit 0, no FAIL.
  • orb-managed-provider-test: exit 0.
  • tsc --noEmit: clean. vitest run: 2365 passed, 3 skipped. Playwright account-vpn.browser.spec.ts: 4 passed.
  • The WireGuard and sidecar fixtures, iOS and Android run only in CI.

Not in this PR

  • Pure --leanui. Its account-connection and alternative-router rows live in files owned by row U5a (live_transport.py, State.lean, tests/test_live_delivery.py) and are covered there (for example test_blocked_selected_country_can_retry_and_direct_requires_confirmation). This PR does not touch them. One difference remains: LeanUI offers "Retry verification" for every blocked route, including one still awaiting verification. Moving that view onto the shared fixture is left for a follow-up after U5a.
  • configuration_message is read by all three clients, but Core on master does not send it yet (draft Exercise native Antigravity subscription Goal delegation #2003 does). Clients fall back to "VPN routing is unavailable for this credential."
  • Two findings that are not defects. Usage probes go Direct only when no provider hub is present, which happens in tests and not in a running Core. The admin model catalog runs the host's own agy models login, not an Orb account credential; the per-account probe honours the account's route.

The web view now reads Core's VPN and router-access answers through accountVpn.ts, checked against shared/orb-spec/fixtures/account-vpn.json. A route that is still awaiting verification no longer offers Retry; it is reread until it settles.
A provider response carrying X-Orb-Selected-Account, X-Orb-Route, X-Orb-Attempts-Used or another Core attribution header was forwarded ahead of Core's own value. Core now drops the upstream copy of the names it sets.
Both apps derive the row from OrbAccountVpn, the mirror of accountVpn.ts, checked against the shared fixture: unconfirmed answers show nothing, a pending exit is reread instead of offering Retry, native accounts can confirm Direct, an older Core gets the version requirement, and a refused router change shows what Core still reports. 1.84.0 (2026112301).
…uest

Once the first liveness check had reaped an exited wireproxy, every later check raised instead of answering, so reading the account's connection settings and retiring the tunnel both failed with an error. A tunnel whose status can no longer be read now counts as exited: Settings shows the route as blocked, the next request is refused and the tunnel is retired. Also checks the verified route payload (server and both exits) that clients display.
…ts fail

Retry is offered while an exit is still being verified, and any missing path counts as an older Core. Reverted by the next commit; never merge this head.
Reverts the temporary mutant ecabee3: Retry only after a reported failure, and only the same missing path counts as an older Core.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant