Skip to content

feat(account): sign in from the desktop and phone apps (needs owner OK) - #2858

Closed
devswha wants to merge 12 commits into
feat/account-devicesfrom
feat/account-native
Closed

devswha wants to merge 12 commits into
feat/account-devicesfrom
feat/account-native

Conversation

@devswha

@devswha devswha commented Nov 5, 2026

Copy link
Copy Markdown
Owner

Stacked on #2856 (account devices). Title says "needs owner OK": it adds the Sign in with Apple entitlement to the iOS app and a new URL scheme route on Android.

What

Signing in to the account outside a browser tab (docs/account.md, "Signing in"):

  • Desktop app (app/electron): Settings > Phone & devices gains Account (sign in with GitHub or Apple, the account's PCs, Sign out). Sign-in opens the system browser; the account service sends it back to a server on http://127.0.0.1:<port>/callback that the app runs for that one sign-in (RFC 8252, code and state in the query). The page finishes the sign-in with the PKCE verifier it kept. Only the server's own pages get the bridge (ovisAccount, checked by sender frame in main), the app opens only the account service's own origin, and the listener takes only the return naming the state of the sign-in it opened, with a code or an error; anything else is turned away and the wait goes on. The account service is named with OVIS_ACCOUNT_SERVICE_URL (https only); with none, nothing changes.
  • iOS (OvisAuthPlugin.swift): GitHub (and Apple on the web flow) in an ASWebAuthenticationSession returning to ovis://account/callback; Sign in with Apple natively, asking for no name and no email, its identity token sent to the apple_id_token grant with the raw nonce whose SHA-256 Apple signed.
  • Android (OvisAuthPlugin.java, manifest intent filter): both providers in the browser, back to ovis://account/callback. Another app can send that address too, so only the return naming the waiting sign-in's state, with a code or an error, is taken. A replaced or failed call is released.
  • Page side (src/lib/account/native.ts, desktop.ts, finishOwnSignIn): a return naming another sign-in's state is refused before anything is consumed, and the sign-in just started is dropped.
  • Connect screen (app/web): Sign in to your account opens the hosted shell's front page, only in a build made with OVIS_APP_ACCOUNT=1.

Owner steps (before a store build ships this)

  1. Turn on the Sign in with Apple capability for the app ID sh.ovis.app: https://developer.apple.com/account/resources/identifiers/list (open sh.ovis.app, tick Sign In with Apple, Save).
  2. Regenerate the provisioning profiles that include it: https://developer.apple.com/account/resources/profiles/list
  3. App Store Connect review notes for the build: say the app offers GitHub and Sign in with Apple side by side (guideline 4.8), and that signing in is optional: https://appstoreconnect.apple.com/apps

Depends on

  • The desktop server page's Content-Security-Policy has to allow the configured account service in connect-src; that change is in the contract branch below (server/static.ts). Until it lands, the desktop sign-in's token exchange is blocked by the policy.

Tests

  • app/electron/src/accountSignIn.test.ts: the callback with the expected state is handed back and the listener stops; other paths, a missing code, or another state are turned away while it keeps waiting; two starts at once leave one sign-in, and a new one replaces the old.
  • src/lib/account/account.test.ts: an older sign-in's return is refused in place of the one just started, and drops it.

Validation

  • bun run check fast at 81896d5: ok (typecheck, build, unit tests). app/electron: bun run typecheck, bun test src.
  • Not run: iOS and Android device builds (no native CI here); the Swift and Java changes are reviewed, not compiled.
  • Known flaky, unrelated: app/electron/src/children.test.ts "startServer ... stops it" fails about 1 run in 4 on this machine without this PR's changes (exited comes back null).

Settings > Phone & devices gains Account in the desktop app: Continue with
GitHub or Apple opens the system browser, the account service sends it back to a
server on 127.0.0.1 that the app runs for that one sign-in (RFC 8252, the code
in the query), and the page finishes the sign-in with the PKCE verifier it kept.
Signed in, it lists the account's PCs and offers Sign out.

The app names the account service with OVIS_ACCOUNT_SERVICE_URL (https only);
with none, nothing changes. Only the server's own pages get the bridge, and the
app opens only the account service's own address.

(cherry picked from commit cba57492caae8169d11240e31b772d811215f7dd)
… Apple

An in-app OvisAuth plugin carries the sign-in: on iOS, GitHub opens in an
ASWebAuthenticationSession and Sign in with Apple runs natively (no name or
email asked), its identity token going to the apple_id_token grant with the raw
nonce whose SHA-256 Apple signed; on Android, both open in the browser and come
back to ovis://account/callback through an intent filter. The page finishes the
sign-in itself, as in a browser; the plugin keeps no token.

The connect screen offers Sign in to your account, opening the hosted shell's
front page, only in a build made with OVIS_APP_ACCOUNT=1. The iOS app gains the
Sign in with Apple entitlement.

(cherry picked from commit a67163254e6856580e87b4e66ef1d131630836f7)
@coderabbitai

coderabbitai Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • 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

@devswha

devswha commented Nov 5, 2026

Copy link
Copy Markdown
Owner Author

Review findings before opening, and how they were resolved (1fdeed7)

Codex (gpt-6.1-terra, xhigh, adversarial):

Severity Finding Resolution
MEDIUM A callback from an earlier sign-in could finish the current one (any pending state was accepted) finishOwnSignIn takes only the state of the sign-in this call started, refuses any other before consuming it, and drops its own pending entry. Test added.
MEDIUM Desktop sign-in's token exchange is blocked by the PC page's connect-src 'self' Needs the configured account service in that page's connect-src; asked for in the contract branch (server/static.ts). Noted under Depends on.
LOW Any callback with a state ended the desktop and Android wait The desktop listener and the Android plugin take only the expected state with a code or an error; anything else is ignored and the wait goes on. Test added (desktop).
LOW Android kept replaced and failed calls alive They are released (keep-alive off, releaseCall) before rejecting.
LOW Two desktop starts at once left two listeners The attempt is taken before the port opens; a replaced one stops waiting and closes its port. Test added.

Not reproduced by the reviewer: a different-origin page using the bridge, the open handler opening a non-account-service address, a random injected code redeeming (PKCE).

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Deploying ovis with  Cloudflare Pages  Cloudflare Pages

Latest commit: f815e39
Status: ✅  Deploy successful!
Preview URL: https://d66e87cb.ovis.pages.dev
Branch Preview URL: https://feat-account-native.ovis.pages.dev

View logs

devswha added a commit that referenced this pull request Nov 5, 2026
…ce keeps (#2867)

Stacked on #2858 (sign-in from the desktop and phone apps).

## What

- **docs/guide.md**, under On your phone: **Through an account**.
Signing in is optional; QR pairings move into the account by themselves
the next time each PC opens; a PC marked **Needs approval** is joined by
comparing digits; a device already in the account approves a new one by
picking its number out of three, and one approval reaches every PC. Who
gets into a PC is still decided by that PC alone, where **Revoke**
always works.
- **Privacy policy** (ovis.sh/privacy, English and Korean): **Your
account**, saying what the account service at `account.ovis.sh` stores
(a random account id, the provider and a hash of its id for you, token
hashes, the PC list with each PC's name, relay id, public key and relay,
signed add/remove records for at most 30 days, join requests with the
device's name and public key for 10 minutes) and what it never receives
(what you type, what PCs show, files, the digits you compare, private
keys); and the account service in the list of what the app connects to.

## Validation

- `bun run check fast` at b30f255: ok (typecheck, build, unit tests);
`scripts/ovis-site.test.ts`, `scripts/ovis-site-platform.test.ts` pass.
- Docs only: no behaviour change, so no new tests.
@devswha

devswha commented Nov 5, 2026

Copy link
Copy Markdown
Owner Author

Landed as part of #2867 (the whole account stack was merged there in one squash).

@devswha devswha closed this Nov 5, 2026
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