SPB Git

Repository Public

APPLE-NATIVE-AUDIT.md 4.9 KB 46 lines markdown

1# Apple native — initial audit (2026-11-20)23Scope: what the existing Claude Remote / Codex Remote platform really offers, read from the code at4`claude-remote.git` @ `ae3306f` and from the two production instances, before any native code was written.56## Platform as found78| Item | Finding (source) |9|---|---|10| Code | One pnpm monorepo: `packages/shared` (zod DTOs, wire formats, states, agent profiles), `apps/runtime`, `apps/server` (Fastify, ~5.4 k lines), `apps/web` (Next 16 static export) |11| Instances | Two, same code, on node M5M36: Claude (`:8620`, db `claude_remote`, https://claude.spboucher.ai) and Codex (`CR_AGENT=codex`, `:8630`, db `codex_remote`, https://codex.spboucher.ai). Both `main`, clean, in sync with origin |12| Privilege boundary | Server never spawns anything; the runtime (unix socket 0600 + bearer) is the only process that touches tmux, PTY, files, git. Public path: browser → Caddy (BHS64) → server |13| Sessions | Real CLI in tmux `cr-<uuid>`; a client = one `tmux attach` through node-pty; history replay + live screen on every attach, painted in the normal buffer. States set from CLI hooks, never from parsing output |14| REST / WS | `/api/v1`: auth, projects, sessions, files (+git), tasks, cluster, skills/MCP, system, notifications, settings, OpenAPI. WS: terminal stream (binary PTY + JSON control), task log stream, events |15| Authentication | Password (argon2id) + mandatory second factor (TOTP or passkey); a passkey with user verification is also accepted on its own (`/auth/passkey/login/*` without a session). `@simplewebauthn/server` v14, UV required, resident key required |16| WebAuthn RP | RP ID = host of `CR_PUBLIC_ORIGIN`: `claude.spboucher.ai` and `codex.spboucher.ai`; expected origin = the same https origin |17| Production accounts | Each instance: 1 administrator, 1 registered passkey, no TOTP (database counts, 2026-11-20). The two instances have separate accounts and separate passkeys |18| Browser session | Cookie `__Host-cr_sid` (HttpOnly, Secure, SameSite=Strict), CSRF header + exact `Origin` on mutations and WS upgrades; idle 12 h, absolute 30 d |19| Devices | `GET/DELETE /auth/devices` list passkeys and browser sessions; revocation closes WebSockets (4401) |2021## Gaps for native clients2223| Gap | Evidence | Decision |24|---|---|---|25| No Apple App Site Association | `GET /.well-known/apple-app-site-association` → 403 on production | Add a public AASA route (webcredentials + applinks) — required for native passkeys on the same RP ID |26| No credential usable outside a browser | `docs/api.md`: "no API token … cookie only"; guard requires cookie + Origin + CSRF | Add native sessions: bearer token, `client_kind='native'`, short-lived token rotated with a device-bound P-256 key (Secure Enclave). Cookie rules untouched; a bearer needs no CSRF because it is not an ambient credential |27| Sessionless passkey challenge lives in a cookie | `__Host-cr_pre` in `factors.ts` | Native variant returns an opaque single-use `challengeToken` |28| No push | `notifications/service.ts`: "Web Push is NOT implemented"; no APNs | Device-token registration + APNs HTTP/2 sender fed by the existing `Notifier`; payloads never carry terminal content |29| No lightweight status for widgets / menu bar | — | `GET /native/summary` |30| Device list knows only browsers | `Device.kind` = passkey / session | Additive `native` kind with platform, model, app version |3132Specified in [NATIVE-API-CONTRACT.md](NATIVE-API-CONTRACT.md).3334## Documentation claims that are not production facts3536- Passkeys were verified with a software authenticator only; the registered production passkeys were created by the owner in a browser. Where each one is stored (iCloud Keychain or another provider) cannot be read from the server; a passkey kept outside iCloud Keychain or a compatible credential provider will not be offered to the native apps on other devices.37- Never verified on the platform: real iPhone, Web Push, registry install, local models, a real remote task.38- `docs/authentication.md` still says no administrator exists; both instances have one.3940## Decisions41421. **Separate repository on the Mac** (`~/Desktop/Cluster/apple/MacLustr/ClaudeRemote`, spbgit `claude-remote-apple.git`) instead of `apps/apple/` in the monorepo: the monorepo's working copies are the deployed directories on a node without Xcode, and nothing may live under `~/Desktop` there; Apple projects are the documented laptop exception.432. **One code base, four apps**: the agent profile (base URL, RP ID, names, accent, URL scheme) is build configuration; Claude Remote and Codex Remote differ only by it, exactly as the two web instances do.443. **Sign-in mirrors the web**: same account, same passkey (Touch ID / Face ID through AuthenticationServices), password + second factor, TOTP when enrolled. No new credential database.454. Bundle ids `ai.spboucher.clauderemote`, `ai.spboucher.codexremote` (shared by macOS and iOS), team `3YM54G49SN`; capabilities registered 2026-11-20: Associated Domains, Push Notifications, App Groups.46
Files main
Menu

Theme