Repository navigation
Pendant app shell: pair and signed writes - #11
Merged
Merged
Conversation
Worktree create needs a repository, and the scratch workspace sat in /tmp with none. seed.sh now creates /tmp/pendant-scratch-repo (one fixture file, one commit, a scratch identity) and starts the workspace there, so worktree.create and worktree.list resolve a repo. Fixture content only.
net/pair.rs speaks the bridge's pairing protocol: - Payload parses pendant-pair:v1:<32 hex> and never prints the nonce. - pair signs pendant-pair:v1 over the device id, public key and nonce; open_grant signs pendant-grant:v1 over a fresh challenge. - prompt, approve/deny and worktree create each take their own challenge and sign pendant-sign:v1, sent in the x-pendant-device, x-pendant-signature and x-pendant-challenge headers. The worktree body is the bridge's CreateWorktree in its field order, since the bridge signs its own re-serialization. - The device id derives from the public key. Every signature runs on a worker thread, because the device key asks for a biometric each time. net::live::Live gains pairing (Unpaired, Pairing, Paired) and grant_until signals and the calls the screens make: pair / pair_with, open_grant, prompt, approve, deny and worktree_create. A refusal that says unpaired or revoked drops the stored pairing and shows the app as unpaired; a grant refusal closes the grant. lib.rs adds Route::Pair, reached by PENDANT_START=pair or a pendant://pair?code=<payload> link (nsh.json claims the pendant scheme). agents::pairing is a placeholder page for the screens to replace. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The simulator has no Secure Enclave, so for target_abi = "sim" only the device key is a Keychain P-256 key with the BiometryCurrentSet access control. Device targets keep the Secure Enclave key as their only stored protection: the simulator variant, its constants and its dependencies are compiled for the simulator target alone. - The simulator reads entitlements from the executable's __TEXT,__entitlements section, as Xcode links them; an ad hoc signature carrying keychain groups is refused at launch. The key code embeds sim-entitlements.plist (an application identifier and a keychain group under it) there. - The simulator's Keychain signed with the key without asking for Face ID, so on the simulator each signature first passes LocalAuthentication (deviceOwnerAuthenticationWithBiometrics) with the signature's reason. - nsh.json adds NSFaceIDUsageDescription. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
keystore.rs gets an Android implementation in place of Unsupported: an AndroidKeyStore P-256 key that needs a strong biometric for every use (timeout 0, invalidated by a new enrollment), and signs only after a BiometricPrompt match bound to the signature through a CryptoObject. - android/PendantKey.java holds the Keystore and BiometricPrompt calls, since the prompt needs a subclass of its AuthenticationCallback and nsh 0.5.0 has no hook for an app's Java. build.rs compiles it to dex with javac and d8 for Android builds only (nothing for other targets, so a host build needs no JDK); no dex, class or jar is committed. - The library embeds that dex and loads it once with InMemoryDexClassLoader under the app's class loader, finding the VM with JNI_GetCreatedJavaVMs. Nothing is fetched at run time. - android/add-biometric-permission.py adds the one permission BiometricPrompt requires, USE_BIOMETRIC, to the manifest nsh packaged, then zipaligns and re-signs with the same local debug key using SDK build-tools. It fails unless aapt2 shows that permission as the only change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Pairing had no request log, so a proxied pair could not be evidenced. The handler now logs method, path, via_serve and forwarded (presence of a Forwarding or X-Forwarded-For header) as booleans and fixed strings only: no header value, address, nonce, device id or key. A test captures the emitted line and asserts none of those values appear.
The iOS runner of nsh 0.5.0 keeps nsh Storage in memory only, so the paired device id was gone after a relaunch and the app showed itself unpaired. The id (not a secret; the key stays in the Keychain or Keystore) now goes in a small file in the app's data directory: nsh's data_dir when the host sets one, else the platform's per-app place (Application Support in the iOS container, the package's files directory on Android). It is written beside and renamed into place, and read back only when it is a well-formed device id. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A UI test launches the app without keeping its stderr, so the pairing and write lines were lost on the simulator. trace() on iOS now also writes each line to syslog, which the unified log keeps (log stream / log show). The lines carry no payload, key or signature. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
open_grant and each write now log a "requesting" line first, and open_grant logs its refusal, so a device log tells a call that never started from one refused before the biometric (not paired here, no challenge). The lines name the call and the agent only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
herdr only prompts a pane whose foreground process matches a known harness, so scripted reported agents could not be prompted or sent keys. Each pane now runs agent.sh: a bash fixture, no model, no network, no tokens, which reads input, prints PENDANT-SCRATCH-INPUT, shows an approve bar with a decision line on the blocked pane, and keeps re-reporting its state. seed.sh makes a fresh mktemp dir holding one symlink to agent.sh named after a supported agent, prepends only that dir inside the pane's env -i PATH, waits for detection and renames the agents scratch-<n>. teardown.sh removes the dir. No fixture file is named after a harness in the repo.
Reports now carry the detected agent label; a foreign label stops herdr from treating the pane as a promptable agent, so the seed no longer renames agents. The agent reads single keys in non-canonical mode, so the approve bar reacts to y and n without an Enter, and a buffered line with no newline is reported on the next idle tick so a prompt still shows up. Verified on the scratch session: agent prompt on w1:p3 prints PENDANT-SCRATCH-INPUT, agent send-keys y/n on w1:p2 print the decision lines, pane text is fixture-only, and /v1/snapshot still shows four agents, one blocked.
net::live::spawn_detached (and Live::spawn_detached) runs a future under the root owner the live link was started in, the scope whose tasks are known to run, and keeps its task handle until the future ends, since dropping an nsh task handle cancels the task. A write started from a page can use it so leaving the page does not cancel the write. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
detached_write and detached_pair made their task under a fresh create_root; under the engine that task was never polled (the press and its handler fired, but the write's first line never ran), so busy stayed set and every write button stayed disabled. Both now hand the task to net::live::spawn_detached, which runs it under the app root and keeps its handle until it ends; detached_write still settles only while its page lives. The press and layout traces stay as they were. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The live link's start now traces "build <sha>" from PENDANT_BUILD_SHA,
given at build time ("dev" when unset), so a device run's log names the
exact app it tested.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pair() reused the stored key, so after a host revoke a new payload paired the revoked device id again and the bridge refused it. A pairing now deletes any stored key and creates a new one first: each pairing is a new device identity, and a revoked key never comes back. The pair page is only reached while unpaired, so no live pairing is lost. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Pendant app shell, pair and write (pack 2a, G2). The nsh app pairs through the tailnet proxy, signs every write with a biometric-gated device key, and sends prompt, Approve, Deny and worktree create to a scratch session. A host revoke refuses the next write.
app/src/platform/keystore.rs.aarch64-apple-ios-simtarget alone gets a Keychain P-256 key with a biometric access control, plus a LocalAuthentication check before each signature. Its entitlements come fromsim-entitlements.plist, sim target only.app/android/PendantKey.java), compiled to dex bybuild.rsonly for Android and loaded in memory.add-biometric-permission.pyadds exactlyUSE_BIOMETRIC, because nsh 0.5.0 writes a fixed manifest template. It fails unless theaapt2permission dump gains exactly that one entry.app/src/net/pair.rsandlive.rs.pendant://pairlink.app/src/agents/./v1/pairlogs one info line withvia_serveandforwardedas presence booleans only. A test asserts that no header value appears in it.scripts/scratch/runs a fixture agent in each pane (no model, no network) so herdr accepts prompts and keys. It has a made-up git repo for worktrees, and session names are guarded.Not changed
app/src.Test plan
aarch64-apple-iosbuild has no software-key symbol🤖 Generated with Claude Code