Files
cthulhu-tentacles/remote/security-ui.md
T
Chase CichorzandClaude Opus 5.5 dcdbe2b603 Prepare Remote 0.1.2 with Orca key handling and remembered connections
Apply the four-patch Remote series: accept Orca-style Shift and unflagged extended keys, add browser/media mappings, review untrusted certificate fingerprints during explicit Connect, and retain recent successful connections in private storage.

Report history-write failures without ending live connections, add failure/storage/trust regressions, and document the required reader revision and remaining live accessibility acceptance.

Validated with make check, the complete Remote race suite, private Xorg capture and key-helper cleanup checks, and publisher tests. Linux amd64/arm64 archives reproduce byte-for-byte.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 21:19:39 -05:00

7.8 KiB

Remote certificate review and saved-key form handlers

Current integration: the subsequent source command now registers the combined continuation behind reader-owned local consent and sensitive input capture. It adds explicit persistent-pin Remember/Forget. The original library increment below remains its historical verification record; physical-source acceptance and desktop services are still pending.

Remote 0.1.2 also opens fingerprint review after Connect fails certificate verification. This uses a separate inspection connection with no channel key. Trust once or Trust and remember resumes that explicit Connect through a fresh verified handshake and reader-owned access selection. Cancel returns to options. Inspection from More options still requires a separate Connect. The following original increment describes the earlier explicit-inspection workflow.

Implemented as a source-library increment on 2026-11-03, on Tentacles master at 63e84e9 with the existing coordinator work preserved. The maintained remote branch matched that revision when checked. This uses the adjacent reader's public Go SDK at 573d15d; no reader files changed.

These are library handlers, not production connection controls. The later connection workflow combines them with the coordinator, explicit saved-key loading, Connect and status/Disconnect in private fixtures. There is no executable, command registration or local input-origin authorizer in this increment. A synthetic Submission cannot prove that a person chose an action locally. Production wiring must wait for that reader-owned check, including rejection of remote/injected approval actions.

Certificate inspection and review

probe_certificate takes an endpoint and a workflow context, with no channel key argument. The caller must explicitly start this background operation; it must not be an automatic fallback after a CA, hostname or pin failure. The inspection socket deliberately bypasses certificate authentication, completes TLS within the existing 15-second dial/handshake bound, sends no application bytes and closes. Cancellation interrupts a stalled handshake.

The result retains only endpoint identity, the observed SHA-256 leaf-certificate digest, any previous pin digest and workflow lifetime. Server-supplied certificate subject/issuer strings never enter the form. Inspection saves, copies and logs no certificate, fingerprint or channel key.

The public SDK form provides navigable details and three buttons:

  • Copy fingerprint returns a host clipboard request for the observed digest. It keeps the review open and does not approve trust. There is no direct clipboard access, automatic copy or fingerprint-file write.
  • Trust once consumes the review and returns an endpoint pinned to that exact certificate, host and port. It does not save/replace a stored pin or mint a reader action/lease. The future connection owner must use this endpoint for one explicit coordinator attempt and discard it afterward.
  • Cancel, form cancellation or an already-cancelled workflow/handler context consumes the review without returning an approved endpoint.

Details explain independent fingerprint verification, the checks an exact pin replaces (CA, hostname and expiry), relay visibility of session contents and the lack of authenticated human identity. A changed certificate shows both old and new fingerprints. Reading/activating a details row cannot approve it. Concurrent/repeated terminal submissions cannot consume a review twice.

The inspection socket is never reused for a session. The existing transport performs a fresh TLS handshake and verifies the exact approved pin before sending protocol/version or channel-key bytes. Rotation between review and join fails authentication without disclosing the key. Normal connections still use CA/hostname validation or an already-approved pin; no trust fallback was added to the transport or coordinator.

Explicit saved-key actions

new_key_actions freezes an already-selected endpoint for a workflow and an open settingsStore. Form creation neither loads a saved key nor connects. Its entry is empty, transient and secret, with a 512-character UI bound; submission also enforces the transport's stricter 512-byte UTF-8 key limit. Forget and Cancel do not require entry text.

Remember key explicitly stores a validated submitted key using existing endpoint-bound owner-only atomic storage. Invalid input returns a fresh empty secret form and a generic correction message. Forget saved key removes the store's single saved-key slot; the form explains that this includes a key saved for another endpoint and does not disconnect an active session or erase disk history. A storage error reports failure rather than success. Neither action returns a key in presentation, form text or clipboard requests.

Remember/Forget consume their workflow once a valid storage action is admitted; cancelled workflows cannot subsequently save/delete. Cancellation after admission does not roll back a filesystem operation that has already started. Settings and existing pins are untouched. The caller must keep the store open through handler completion and cancel the workflow on form closure, local approval replacement, lock/handoff or process-session retirement. Use a workflow context, not the short-lived context of the RPC that opens a form.

The standalone continuations are named remote-review-certificate and remote-saved-key; the combined workflow routes both through its remote-connection continuation. None is registered in production. Their owner must serialize workflows, cancel superseded ones and supply verified local-origin submissions before any production registration. No persistent settings-page secret or saved session consent is introduced.

Verification and remaining integration

From the Tentacles repository, with private loopback sockets allowed:

GOCACHE=/tmp/cthulhu-cache GOPROXY=off go test -race ./remote/src -count=1 -timeout=60s
make check

Both passed for this increment, including nine new test functions and their subcases. git diff --check also passed.

The focused suite covers no application bytes during inspection, changed-pin disclosure, explicit copy, cancellation, one-use/concurrent review consumption, fresh authenticated join and certificate rotation between review and join. Saved-key fixtures cover masked empty controls, explicit storage, endpoint isolation, secret-free replies, invalid keys, cancellation and failed Remember/ Forget with preservation of existing credentials. Endpoint validation now also rejects control characters and invalid UTF-8 before constructing forms or dialing. The complete Remote race suite includes existing CA/pin, framing, membership, storage and coordinator regressions. make check additionally checks vet and existing Hello World, Wormhole and Battery Status actual-host workflows.

These fixtures call library handlers with synthetic submissions. They do not establish real form traversal, local input origin, audible masking, physical Braille, clipboard ownership or a production Remote workflow. There is no new live command to test yet. Once wired, review both fingerprint variants with Tab/Shift+Tab and list navigation; verify that Copy alone changes the clipboard, Cancel saves nothing, secret editing stays masked, and Remember/Forget failures are announced. Recheck ordinary Tentacle forms and CA/pin connections, including certificate rotation. The reader's existing secret-entry native harness remains prerequisite evidence rather than acceptance of these new forms.

Still pending: production local consent and input provenance, endpoint/role selection and command registration, persistent-pin review UI, lock/handoff integration, desktop services and all live interoperability/release gates. The Phase C trust/Remember-key checkbox in the parent plan remains open.