Skip to content

fix(app): keep a PC address that redirects to Ovis in the app - #1903

Merged
devswha merged 2 commits into
mainfrom
fix/app-external-browser
Oct 24, 2026
Merged

devswha merged 2 commits into
mainfrom
fix/app-external-browser

Conversation

@devswha

@devswha devswha commented Oct 24, 2026 •

Copy link
Copy Markdown
Owner

What was wrong

Testers on Android typed their PC's address on the app's connect screen and Ovis opened in Firefox instead of in the app.

Capacitor 8.5.3 hands every main-frame navigation whose host or scheme differs from server.url to the system browser (Bridge.launchIntent → ACTION_VIEW on Android, UIApplication.open → Safari on iOS), and a server redirect is such a navigation. So a PC address that answers with a redirect left the app: http to https (Caddy and nginx setups redirect by default), an IP address to the PC's name, a sign-in page in front of it. A redirect to another port on the same host stayed in the Android WebView, but without Capacitor's bridge (it is injected for the server.url origin only): no Change PC, no push, and the PC was never saved. The Ovis server itself never redirects, so the testers' setups had a proxy or tunnel in front.

The fix

Until the first page shows, a main-frame redirect of the address being opened to another http or https origin is held back, and the app asks that origin's /api/health?scope=bridge, the open route Ovis answers to anyone ({ ok: true, auth: { ... }, bridge_protocol: 1 }). Only that shape counts: ok a JSON true, auth an object, and bridge_protocol an integer this app knows (1, BRIDGE_PROTOCOL in shared/machines.ts), in strictly valid JSON: one value for the whole text, quoted names given once, ASCII hex in \u escapes, nesting at most 32 deep. Android reads it with its own strict reader (org.json takes unquoted names and ignores text after the object); iOS checks it before JSONSerialization, which lets a trailing comma pass and keeps the first of two equal names. shared/bridge-protocol.test.ts fails when BRIDGE_PROTOCOL moves without the app's range. It follows up to five redirects of that question itself (no automatic redirects), gives up after about ten seconds in all (on Android a slow name lookup, which cannot be cut short, can add a few) and reads at most 64 KB.

  • An origin that answers as Ovis (http to https, an IP address to the PC's name, another port) becomes the PC and opens again as the WebView's first page, so it gets the bridge, and it joins the saved list once a page of it loads. A pairing link's path and query (?pair=) carry over. The address that only redirected is not saved.
  • Anything else (a sign-in page, another site, a loop, no answer) gets no bridge and is not saved. The app's error page says where the address led: "It redirected to X, which did not answer as Ovis. If that is your PC, open X itself."
  • Once the first page shows, Capacitor decides on redirects as before (the browser for another host). From then on a redirect could come from a link the user followed to a page that is not the PC's (another port on its host), which must not choose the PC. The window closes at the first commit (Android onPageCommitVisible, iOS didCommit), not when the page finishes loading, so a PC page with a resource that never finishes does not keep it open.
  • The way there must not go over public plain http or from https to http, the redirect and each hop of the app's question included: the app does not switch to such an Ovis on its own, which would skip the connect screen's warning before a public http address (publicHttp in app/web/shell.js, ported to both platforms). The error page names the hop and the Ovis address to open directly. A tailnet or home address (100.64.0.0/10, 192.168.x.x, *.ts.net, *.local, a one-word name) to another one, or anything to https, is fine.
  • Links to other sites, such as GitHub, still open in the browser.
  • Five PCs in a row made this way end on the error page ("Too many redirects"); the count resets when the user opens or retries a PC and when a PC page loads.

Trust: before the first page shows, a redirect can only come from the address the user is opening, and that address's own page would get the bridge anyway, so the origin it leads to gets nothing more, and only if it answers /api/health as Ovis. A sign-in or other page a proxy redirects to never gets the bridge.

Per platform:

  • Android: MainActivity's BridgeWebViewClient catches request.isRedirect() in the main frame before Capacitor sees it and probes on a background thread (PCStore.ovisOrigin, PCStore.startOn). Same-origin redirects still go to Capacitor. The probe's budget holds even against a server that trickles its headers or body: a scheduled disconnect() ends the request at the deadline, and the body loop checks it too.
  • iOS: with fix(app): show the PC being opened on iOS, and say so when it does not answer #1860's opening cover, the cover stays up while the app asks the redirect's target (a redirect is not an answer of the PC's), and goes when the error page or the adopted PC loads. WebKit has no public redirect flag on a navigation action, so NavigationFailureProxy takes any main-frame action to another origin that arrives before the first commit, while the main frame's navigation is provisional, and probes with an ephemeral URLSession (PCStore.ovisOrigin(leadingTo:), streamed with the 64 KB cap, StrictJSON first, then ok must be a JSON boolean and bridge_protocol an integer CFNumber in range). App Transport Security keeps that URLSession to https and local names, so a redirect to plain http on a tailnet address or name ends on the error page naming the address to open directly (documented in docs/native-app.md).

Checked

  • ./gradlew :app:testDebugUnitTest: PCStoreTest 8/8 pass. Mutations: without the disconnect() watchdog, the header-trickle case runs into the test's 20 s timeout. Without the body-loop check, it still passes, ending about 3 s late, so that check is a backstop.
  • Android emulator (Android 16 image, debug build of this commit, Firefox as the default browser, test servers on the host reached as 10.0.2.2 and, through adb reverse, as localhost):
    • Typed 10.0.2.2:7491 → 302 localhost:7492 (Ovis): the app's probe (Dalvik user agent) asked /api/health?scope=bridge, then the WebView loaded http://localhost:7492/ with Capacitor.isNativePlatform() === true. Saved was [http://localhost:7492], Ovis stayed the top activity, and no Firefox task opened.
    • Typed 10.0.2.2:7497 → 302 localhost:7498 (a sign-in page): only the probe reached 7498, and the WebView never loaded the sign-in page. The error page read "It redirected to http://localhost:7498, which did not answer as Ovis. If that is your PC, open http://localhost:7498 itself." Nothing was saved, and Firefox did not open.
    • Typed 10.0.2.2:7489 → 302 localhost:7488, whose server trickles response headers forever: the app closed that connection after 9.99 s (Android's own HttpURLConnection, so the watchdog holds on a device too), and the error page showed 11 s after Open.
    • On the loaded PC page at localhost:7492, a link redirecting to 10.0.2.2:7492 (Ovis) opened in Firefox (ACTION_VIEW dat=http://10.0.2.2:7492/). There was no probe, and the PC and saved list were unchanged on returning.
    • The same check on a PC page whose picture never answers (10.0.2.2:7499, readyState still interactive): the link redirecting to localhost:7492 opened in Firefox with no probe, and the app kept 10.0.2.2:7499.
    • The GitHub link opened in Firefox (ACTION_VIEW dat=https://github.com/devswha/ovis), and the PC was unchanged on returning.
  • iOS 27 simulator (Xcode build of this commit's app/ios, servers tunnelled to the Mac):
  • After the merge pass's gate review (second commit), reviewed by omo-native-code-reviewer and Codex Sol:
    • PCStoreTest 12/12, with new tests for rejected protocol values (-1, 0, 0.5, 1.0, 1e0, 2, "1", true, null, 20 digits), non-strict JSON (unquoted names, trailing text, two objects, a duplicate name, single quotes, a trailing comma, a fullwidth \u escape, 60000 [), the way's hops (https to http, a later hop to public http, private to public http, and the tailnet, home and https cases that stay allowed) and publicHttp against shell.js's cases. Each check was mutated away once (range, end of text, depth cap, ASCII hex, whole path), and the matching test failed.
    • iOS has no unit-test target, so the PCStore/StrictJSON part of the Swift file was compiled with swiftc on the Mac against the same cases: 61/61.
    • iOS simulator, rebased on fix(app): show the PC being opened on iOS, and say so when it does not answer #1860: a redirect target answering bridge_protocol: 3 ended on the error page with nothing saved, and one answering 1 was adopted with the bridge. A sign-in page was refused.
    • Android emulator (Firefox as the default browser), with this commit's debug build: when the PC's health answered bridge_protocol: 3, the typed 10.0.2.2:7491 ended on the error page with nothing saved. 10.0.2.2:7486 redirects to http://127.0.0.1.nip.io:7492 (a public-looking http name that resolves to the PC), which answered as Ovis. The app still refused it: "It redirected over plain http to http://127.0.0.1.nip.io:7492, which the app does not follow on its own." Nothing was saved. The first round's checks passed again: the Ovis redirect was adopted with the bridge, the sign-in page and the trickling server (cut off after 9.99 s) ended on the error page, and after the page loaded, the Ovis link and the GitHub link went to Firefox.
  • bun run check fast on the rebased head: passed (unit tests 6413 pass, 0 fail, 13 skip; typecheck and build).
  • Reviews: omo-native-code-reviewer and Codex Sol both approved this behaviour. Their minor note, that DNS can exceed the budget, is reflected in the docs wording.

Note for the Android bundle

The fix is in the native shell, so ovis-android-1.0-2.aab, built before it, does not have it and needs to be built again from a commit that includes it.

@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 0cf444a and a04f64d.

Files selected for processing: 10
  • app/android/app/build.gradle
  • app/android/app/src/main/java/sh/ovis/app/HerdrShellPlugin.java
  • app/android/app/src/main/java/sh/ovis/app/MainActivity.java
  • app/android/app/src/main/java/sh/ovis/app/PCStore.java
  • app/android/app/src/test/java/sh/ovis/app/PCStoreTest.java
  • app/ios/App/App/HerdrBridgeViewController.swift
  • app/ios/App/App/HerdrShellPlugin.swift
  • changelog.d/app-redirect-stays-in-app.md
  • docs/native-app.md
  • shared/bridge-protocol.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

📝 Summary

Summary by CodeRabbit

  • New Features
    • Redirects to verified Ovis destinations during initial loading now stay within the app, with the destination treated as the PC address.
    • Redirects to non-Ovis destinations show an in-app error page. Links to other sites continue to open in the browser.
    • Redirects are checked for supported bridge compatibility and unsafe HTTP hops, with limits on redirect attempts.
  • Documentation
    • Updated native app documentation to explain redirect handling on iOS and Android.

Android and iOS now intercept cross-origin main-frame redirects during initial load and probe destinations for a supported Ovis bridge health response. Verified Ovis origins reopen with the target URL components preserved. Other destinations can produce an error. Redirect counters reset on open, retry, and successful load.

Changes: Native app redirects

Layer / File(s) Summary
Health probes and origin validation
app/android/app/src/main/java/sh/ovis/app/PCStore.java, app/android/app/src/test/java/sh/ovis/app/PCStoreTest.java, app/android/app/build.gradle, app/ios/App/App/HerdrBridgeViewController.swift, shared/bridge-protocol.test.ts
Both platforms probe /api/health?scope=bridge and validate the response, including supported bridge protocol values. Probes enforce redirect, timeout, and response-size limits and reject invalid JSON. Android tests cover probe outcomes, address classification, and preservation of target URL components.
Android initial-load redirects
app/android/app/src/main/java/sh/ovis/app/MainActivity.java, app/android/app/src/main/java/sh/ovis/app/HerdrShellPlugin.java, docs/native-app.md
Before the first page appears, MainActivity intercepts cross-origin main-frame redirects and probes their destinations. It reopens verified Ovis origins or shows an error for rejected destinations and redirect limits. Open, retry, and successful loads reset the redirect counter. The documentation describes this behavior.
iOS initial-load redirects
app/ios/App/App/HerdrBridgeViewController.swift, app/ios/App/App/HerdrShellPlugin.swift, docs/native-app.md, changelog.d/app-redirect-stays-in-app.md
Before the first page commits, NavigationFailureProxy intercepts provisional cross-origin navigation and probes its destination. It reopens verified Ovis origins or reports an error for rejected destinations, insecure hops, and redirect limits. Open, retry, and successful loads reset the redirect counter. The documentation and changelog describe the behavior.

Priority: Normal

Estimated code review effort: 4 (Complex) | ~60 minutes

Change: Bug fix

Possibly related PRs

  • devswha/ovis#1697: Both PRs change native app first-load navigation and failure handling.
  • devswha/ovis#1860: Both PRs change iOS provisional navigation behavior in HerdrBridgeViewController and NavigationFailureProxy.
Merge Risk: Minimal · up to a04f6

This change keeps a PC address that redirects to an Ovis server inside the app and refuses non-Ovis destinations. No actionable merge-blocking issue was identified. The remaining uncertainty is limited to real-device redirect behavior, which the author reports testing on an emulator and a simulator.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 34.57% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 81 functions across 7 files. (3 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly summarizes the primary change: keeping PCs that redirect to Ovis inside the app.
Description check Passed The description explains the problem, resulting behavior, platform-specific implementation, security constraints, tests, emulator and simulator validation, and the Android bundle limitation. It uses h…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description explains the problem, resulting behavior, platform-specific implementation, security constraints, tests, emulator and simulator validation, and the Android bundle limitation. It uses headings different from the template but provides the required change and validation information.

Full details: Docstring Coverage

Explanation

Docstring coverage is 34.57% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 81 functions across 7 files. (3 skipped: 3 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches: 💡 2
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@devswha

devswha commented Oct 24, 2026

Copy link
Copy Markdown
Owner Author

CodeRabbit hit its review limit on this PR, so no review ran. Two agent reviews stand in for it. Both read the v4 change in full: an omo-native-code-reviewer pass and a Codex Sol pass (gpt-6.1-sol, read-only). They reviewed f52bf9828. This PR's 614941b is that commit rebased on main, with only the docs/native-app.md wording below changed.

Verdicts: both approve, with no blocker or major finding.

Findings from earlier rounds, resolved in v4:

  • The adoption window had closed only when the page finished loading. A PC page with a resource that never finishes would have kept it open, so a link on that page could choose the PC (Codex Sol M1). The window now closes at the first commit (Android onPageCommitVisible, iOS didCommit). The iOS simulator showed the old build adopting such a target and v4 sending it to Safari; the Android emulator run in the PR body shows the same for v4.
  • The Android probe could run past its budget against a server that trickles headers. A scheduled disconnect() now ends it at the deadline, and the body loop checks the deadline too. PCStoreTest covers the trickle case and fails when the watchdog is removed. On the emulator, Android's own HttpURLConnection closed the connection after 9.99 s.
  • On iOS, NSNumber bridging accepted the wrong JSON types. The check now requires a CFBoolean true for ok and a non-boolean number for bridge_protocol.

Findings on v4:

  • Minor, from both reviews: Android cannot interrupt a DNS lookup, so a slow resolver can stretch the ten seconds. Resolved by rewording the docs to "about ten seconds in all; a slow name lookup, which Android cannot cut short, can add a few". This is what changed since the reviewed commit. A lookup that runs long only delays the error page; it grants nothing.
  • Nit: a cancelled watchdog task stays queued until its delay ends, at most 10 s. Declined: it is bounded and has no visible effect.
  • Nit: the unit test runs the JDK's HttpURLConnection, not Android's. Resolved by the emulator scenario above, which ran against a header-trickling server.

@devswha

devswha commented Oct 24, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@devswha

devswha commented Oct 24, 2026

Copy link
Copy Markdown
Owner Author

Merge pass: this is now under review (Astra gate, native shell). One ordering point: #1860 (show the PC being opened on iOS) is older and already approved, and it conflicts with this PR in app/ios/App/App/HerdrBridgeViewController.swift and docs/native-app.md. #1860 merges first, from the front of the queue. Please rebase onto main once it is in. The gate looks at the change itself, so its findings still apply after the rebase.

@devswha

devswha commented Oct 24, 2026

Copy link
Copy Markdown
Owner Author

Merge pass gate review of 614941b: two blockers. The "answers as Ovis" check is looser than it should be. It decides who gets the native bridge.

1. Any numeric bridge_protocol is accepted, on both platforms (app/android/app/src/main/java/sh/ovis/app/PCStore.java:151-154, app/ios/App/App/HerdrBridgeViewController.swift:100-105)

  • The Android probe accepted bridge_protocol: -1 and 0.5. The Swift side checks only that the value is a number.
  • Fix: accept only the protocol versions this app supports, as positive integers in the supported range, and add tests for the rejected values.

2. Android accepts malformed JSON and trailing garbage (PCStore.java:151-154)

  • With the PR's own org.json dependency, the probe accepted {ok:true,auth:{},bridge_protocol:1} (unquoted keys) and a valid object followed by trailing non-JSON.
  • Fix: parse strictly and require the whole body to be consumed, then add regression tests.

Please also close this, though the gate rates it a note: Android adopts a redirect from https to http, and that skips the connect screen's public-HTTP warning. A user who typed an https address can end up giving the bridge to a plain-text origin. Refuse a downgrade, or route it through the same warning.

Holds

  • The health requests never carry pair. It moves only after the origin is admitted.
  • When a page of the new origin loads, the saved list is updated. Redirects stop being intercepted once the first page shows.
  • Android PCStoreTest passes 8/8, and assembleDebug builds.
  • The iOS simulator build passes on eamac, in a fresh clone that was deleted afterwards.

The merge pass re-checks the fix (changed range only). #1860 merges first, as noted above.

@devswha

devswha commented Oct 24, 2026

Copy link
Copy Markdown
Owner Author

Status for the merge pass: your gate findings are fixed in a local commit, which I'll push once, rebased onto main, right after #1860 merges (the conflict with #1860 is resolved and was built and checked on the iOS simulator). The changes:

  • Protocol: only an integer bridge_protocol this app knows is accepted, on both platforms. That is 1, BRIDGE_PROTOCOL. A new shared/bridge-protocol.test.ts fails when BRIDGE_PROTOCOL moves without the app's range. Trade-off: an app already installed keeps refusing redirects to a server that moves to a newer protocol, so for those it shows the error page naming the address to open directly.
  • Strict JSON on both platforms: valid UTF-8, one value for the whole body, quoted names given once, ASCII hex in \u escapes, depth ≤ 32. Android uses its own reader; iOS adds a syntax check before JSONSerialization, which on its own lets a trailing comma through and keeps the first of two equal names.
  • No insecure http on the way: the redirect and every hop of the app's health question must avoid public plain http and any step from https down to http. The rule is publicHttp from app/web/shell.js, ported. A numeric host in any form other than a plain dotted quad counts as public. A tailnet or home address leading to another one, or anything leading to https, is unaffected.

Checked:

  • PCStoreTest 12/12, with each new check mutated away once and its test failing.
  • The iOS PCStore/StrictJSON code compiled on the Mac against the same cases: 68/68.
  • On the Android emulator, a bridge_protocol: 3 answer and a public-http hop (127.0.0.1.nip.io) were both refused. The earlier scenarios still pass.
  • On the iOS simulator, rebased on fix(app): show the PC being opened on iOS, and say so when it does not answer #1860, a protocol 3 target was refused and protocol 1 adopted.

Reviews: omo-native-code-reviewer and Codex Sol needed three rounds. Sol's later findings were fullwidth \u digits, the iOS trailing comma, the whole-path downgrade, non-canonical IPv4 and malformed UTF-8, all fixed. Both approve the final commit. Declined minors, both on the safe side: a private IPv6 literal with a dotted IPv4 tail, or written in long form, is treated as public.

mp added 2 commits October 25, 2026 02:23
A PC address that answered with a redirect opened in the phone's
browser: Capacitor hands any main-frame navigation to another host or
scheme to ACTION_VIEW on Android and to Safari on iOS, redirects
included. Testers with Firefox as their default browser saw Ovis open
there. A redirect to another port stayed in the Android WebView, but
without the bridge.

Until the first page shows, the app now holds such a redirect of the
address being opened back and asks the target's
/api/health?scope=bridge, which Ovis answers to anyone, following up to
five redirects of that question within ten seconds and reading at most
64 KB. An origin that answers as Ovis (http to https, an IP address to
the PC's name, another port) becomes the PC and opens again as the
first page, with the bridge: the address's own page would have had the
bridge too. Anything else, such as a sign-in page, another site or a
loop, gets no bridge and is not saved, and the error page names where
the address led. Once the first page shows, Capacitor decides on
redirects as before, so a link to a page that is not the PC's (another
port on its host) cannot make that page's redirect the PC. Links to
other sites still open in the browser.
The merge pass's gate found the "answers as Ovis" check looser than a
check that hands out the native bridge should be. Android read
/api/health with org.json, which takes unquoted names and ignores text
after the object, and both platforms took any number as the bridge
protocol (-1 and 0.5 on Android).

Both platforms now read the answer strictly: valid UTF-8, one JSON
value for the whole text, quoted names given once, ASCII hex in \u
escapes and nesting kept shallow (Android with its own reader, iOS with a check
before JSONSerialization, which lets a trailing comma pass and keeps
the first of two equal names). Only an integer bridge protocol this app
knows counts, 1 for now: shared/bridge-protocol.test.ts fails when
BRIDGE_PROTOCOL in shared/machines.ts moves without the app's range.

The way from the address being opened to the Ovis server it leads to,
each hop of the probe included, must not go over public plain http or
from https to http: the app does not switch there on its own, as the
connect screen warns before a public http address. A numeric host in
any form but a plain dotted quad (134744072, 010.0.0.1, 0x8.8.8.8),
which the web view reads as some IPv4 address, counts as public. The
error page names the hop and the address to open directly.
@devswha

devswha commented Oct 24, 2026

Copy link
Copy Markdown
Owner Author

Merge pass: #1860 is merged (ce8ede5). Please rebase this PR onto main now. It conflicts with #1860 in HerdrBridgeViewController.swift and docs/native-app.md. Push the gate fixes together with the rebase: a strict bridge_protocol check, strict JSON on Android, and no https to http downgrade. The merge pass reviews the rebase and the fix together, looking only at the changed range.

@devswha
devswha force-pushed the fix/app-external-browser branch from 614941b to a04f64d Compare October 24, 2026 17:25
@devswha

devswha commented Oct 24, 2026

Copy link
Copy Markdown
Owner Author

Merge pass: rebased onto main after #1860 (ce8ede5c8). The PR is now two commits:

  • 9c63f9af1 is the original change. The conflict with fix(app): show the PC being opened on iOS, and say so when it does not answer #1860 is resolved by keeping both: its opening cover and this PR's redirect handling. The cover stays up while the app asks a redirect's target, because a 302 is not the PC's answer, and goes away when the error page or the adopted PC loads.
  • a04f64dda answers your gate review: a strict health answer and a known protocol, with no insecure http on the way (details in my comment above).

Checked on this exact tree:

  • bun run check fast: passed (unit tests 6413 pass, 0 fail, 13 skip).
  • PCStoreTest 12/12.
  • The Android emulator run, done on the same app/android (git diff empty), covers protocol 3, a public-http hop, the earlier redirect cases, and after-load links going to Firefox.
  • The iOS checks ran on the same app/ios merged with fix(app): show the PC being opened on iOS, and say so when it does not answer #1860 (git diff empty): the build, the 68/68 PCStore/StrictJSON harness on the Mac, and the simulator adopting protocol 1 and refusing protocol 3 and sign-in.

Reviews: omo-native-code-reviewer and Codex Sol both approve the final gate commit after three rounds. The PR body is updated.

@devswha

devswha commented Oct 24, 2026

Copy link
Copy Markdown
Owner Author

Merge pass review-work report. Overall: PASSED.

Lane Verdict Confidence
Gate review of 614941b (another model; programming + remove-ai-slops applied directly) REJECT: any numeric bridge_protocol accepted; Android took malformed or trailing JSON; https to http adopted without the warning HIGH
Gate re-check of a04f64d and the rebase onto #1860 APPROVE MEDIUM-HIGH

QA at a04f64d

  • Android, local: :app:testDebugUnitTest (PCStoreTest 12/12) and :app:assembleDebug pass.
  • iOS, on eamac: a simulator build (xcodebuild -project App.xcodeproj) passes, in a fresh clone that was deleted afterwards.
  • shared/bridge-protocol.test.ts and conventions pass, and so does the typecheck. git merge-tree is clean.

Gate

  • Strict health check: Android refuses -1, 0.5, the unsupported protocol 2, unquoted keys and trailing garbage. A real answer with protocol 1 passes. Restoring the old check makes the two new tests fail.
  • iOS: Swift enforces the same strict check (read from source).
  • http: insecure paths are refused before an origin is adopted. A numeric host that isn't a plain dotted quad counts as public.
  • Rebase onto fix(app): show the PC being opened on iOS, and say so when it does not answer #1860: HerdrBridgeViewController.swift keeps fix(app): show the PC being opened on iOS, and say so when it does not answer #1860's cover (the PC being opened, Change PC and Try again) next to this PR's redirect handling.
  • Unchanged from round 1: pair= moves only after the origin is admitted. The address that only redirected is never saved. The limits stay at 5 hops, about 10 s and 64 KB.

Notes (not blocking): hostname exemptions are by name, not DNS-verified, and none of them bypasses the https downgrade check. The custom parser needs maintenance.

All required checks are green and no review thread is open.

CodeRabbit did not review this PR (rate-limited or skipped). The reviews above stand in for it.

@devswha
devswha merged commit f34d16d into main Oct 24, 2026
26 of 27 checks passed
@devswha
devswha deleted the fix/app-external-browser branch October 24, 2026 18:06
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