Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
f8fa6f6
Review the session engine's TCP control port (ADR-046)
malpern Nov 5, 2026
96cf1b2
Address review notes on ADR-046
malpern Nov 5, 2026
18d8426
ADR-046: state the PID check's limits and require live confirmation
malpern Nov 5, 2026
339131c
ADR-046: spell out owner-exit detection and release-time coverage
malpern Nov 5, 2026
56a172a
ADR-046: add an attacker coverage table and phase 1 acceptance criterion
malpern Nov 5, 2026
0f1930b
ADR-046: clarify the peer check, and qualify the source-only claims
malpern Nov 5, 2026
51d5942
ADR-046: require the peer check on the accepted socket; align ADR-013…
malpern Nov 5, 2026
f02e952
ADR-046: label migration steps as phases; require an owner-exit test
malpern Nov 5, 2026
dd78843
ADR-013: drop redundant status suffix
malpern Nov 5, 2026
c4f177d
ADR-046: pass the owner PID per launch; note the sun_path limit
malpern Nov 5, 2026
9c13d25
ADR-046: worker exits with its owner; mark attacker 3 as partly mitig…
malpern Nov 5, 2026
606fc5f
ADR-046: give long home paths a socket-directory fallback
malpern Nov 5, 2026
04cbc60
ADR-046: note the PID check's fork/exec limit
malpern Nov 5, 2026
99826ea
ADR-046: state that worker adoption stays within one app process
malpern Nov 5, 2026
6da68c0
ADR-046: land phases 1 and 2 together; test the owner-exit window
malpern Nov 5, 2026
0d45d09
ADR-046: record the inherited-connection gap in phase 1 criteria
malpern Nov 5, 2026
59ffce6
Merge branch 'master' into claude/tcp-endpoint-review-6299cb
malpern Nov 6, 2026
05af8e5
ADR-046: name the fork branch that holds the pinned commit
malpern Nov 6, 2026
0e29a54
ADR-046: match the owner's PID version, not just its liveness
malpern Nov 6, 2026
a8c2e4b
ADR-046: specify listener-failure, early-owner-exit and socket-path d…
malpern Nov 6, 2026
963be1b
ADR-046: state the accepted release risk and the submodule-bump order
malpern Nov 6, 2026
8d1d0df
ADR-013: drop the repeated sentence from the new note
malpern Nov 6, 2026
8e5235c
Merge remote-tracking branch 'origin/master' into claude/tcp-endpoint…
malpern Nov 6, 2026
e489044
ADR-046: test the socket-path fallback
malpern Nov 6, 2026
d98b519
ADR-046: add a fast-forward check and a re-verify step for the shippi…
malpern Nov 6, 2026
9f8b949
ADR-046: d9085a9 is now on keypath/bundled
malpern Nov 6, 2026
940e3cb
ADR-046: confirm LOCAL_PEERTOKEN availability during implementation
malpern Nov 6, 2026
414bbc6
ADR-046: run the Rust acceptance tests in CI; check LOCAL_PEERTOKEN i…
malpern Nov 6, 2026
6f7e626
ADR-046: state the panic assumption; make the peer-token reader injec…
malpern Nov 6, 2026
3ea834a
ADR-046: repeat the LOCAL_PEERTOKEN caveat next to the release gate
malpern Nov 6, 2026
6f43c72
ADR-046: name the LOCAL_PEERTOKEN fallback; hedge ADR-013's inline notes
malpern Nov 6, 2026
9f3b783
ADR-046: make the lab check an explicit blocker for acceptance
malpern Nov 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 13 additions & 19 deletions Sources/KeyPathAppKit/Services/Networking/KanataTCPClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,25 +56,19 @@
/// - Simple timeout mechanism
/// - Connection pooling for efficiency
///
/// **SECURITY NOTE (ADR-013):**
/// Kanata v1.9.0 TCP server does NOT support authentication.
/// The tcp_server.rs code explicitly ignores Authenticate messages:
/// ```rust
/// ClientMessage::Authenticate { .. } => {
/// log::debug!("TCP server ignoring authentication message (not needed for TCP)");
/// continue;
/// }
/// ```
///
/// This means:
/// - No client identity verification
/// - Any local process can send commands to localhost:37001
/// - Limited attack surface: only config reloads, not arbitrary code execution
///
/// **Future Work:**
/// Consider contributing authentication support to upstream Kanata.
/// Design would mirror the UDP authentication (token-based, session expiry).
/// Until then, rely on localhost-only binding and OS-level process isolation.
/// **SECURITY NOTE (ADR-013, under review in ADR-046 / #1354):**
/// The engine's TCP server has no authentication, and loopback TCP is not
/// scoped to a user or to the App Sandbox. From reading the source (not yet
/// confirmed on a live install), any local process, including other
/// users' processes and sandboxed apps with the network-client entitlement,
/// can connect to the engine port (default 37001) and:
/// - receive every `KeyInput` event (a keystroke stream) and the config text
/// - press virtual keys (`ActOnFakeKey`), change layers, move the mouse
/// - load any readable file as the config (`ReloadFile`)
/// Virtual keys bound to `push-msg` reach `ActionDispatcher` through
/// `KanataEventListener`. ADR-046 proposes moving this channel to an
/// owner-checked Unix socket.
/// TODO(#1354): revise this note after the lab-VM check and again when ADR-046 lands.

Check warning on line 71 in Sources/KeyPathAppKit/Services/Networking/KanataTCPClient.swift

View workflow job for this annotation

GitHub Actions / quality-full

TODOs should be resolved ((#1354): revise this note afte...) (todo)
actor KanataTCPClient {
let host: String
let port: Int
Expand Down
3 changes: 2 additions & 1 deletion docs/adr/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This directory contains Architecture Decision Records (ADRs) documenting signifi
| [ADR-006](adr-006-apple-api-priority.md) | Apple API Priority in Permission Checks | Partly superseded by ADR-044 |
| [ADR-008](adr-008-validation-refactor.md) | Stateless Validation via SystemValidator | Accepted |
| [ADR-009](adr-009-service-extraction-mvvm.md) | Service Extraction & MVVM Pattern | Accepted |
| [ADR-013](adr-013-tcp-without-auth.md) | TCP Communication Without Authentication | Accepted (under review) |
| [ADR-013](adr-013-tcp-without-auth.md) | TCP Communication Without Authentication | Under review; proposed to be superseded by ADR-046 |
| [ADR-014](adr-014-xpc-signature-mismatch.md) | XPC Signature Mismatch Prevention | Accepted (see ADR-045 note) |
| [ADR-015](adr-015-installer-engine.md) | InstallerEngine Façade | Accepted (see ADR-045 note) |
| [ADR-016](adr-016-tcc-database-reading.md) | TCC Database Reading for Sequential Permission Flow | Superseded by ADR-044 |
Expand Down Expand Up @@ -43,6 +43,7 @@ This directory contains Architecture Decision Records (ADRs) documenting signifi
| [ADR-043](adr-043-opportunistic-manager-consolidation.md) | Opportunistic Manager Consolidation | Accepted |
| [ADR-044](adr-044-remove-full-disk-access.md) | Remove Full Disk Access and browser-history suggestions | Accepted |
| [ADR-045](adr-045-retire-privileged-runtime-stack.md) | Retire the Privileged Runtime Stack | Accepted |
| [ADR-046](adr-046-session-engine-control-channel.md) | Session Engine Control Channel | Proposed |

## Key Decisions Summary

Expand Down
12 changes: 8 additions & 4 deletions docs/adr/adr-013-tcp-without-auth.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@

> **Note (2026-10-31):** This was written for the root daemon. The runtime now runs
> in a user session that holds the user's input permissions, so this risk needs
> review. See ADR-045; tracked in
> review. See ADR-045.
>
> **Note (2026-11-04):** From a source review, the port exposes a keystroke stream and input injection to
> every local process. The review and the proposed replacement are in
> [ADR-046](adr-046-session-engine-control-channel.md); tracked in
> [#1354](https://github.com/malpern/KeyPath/issues/1354).

**Status:** Accepted (under review, see ADR-045)
**Status:** Under review; proposed to be superseded by [ADR-046](adr-046-session-engine-control-channel.md)
**Date:** 2024

## Context
Expand All @@ -20,12 +24,12 @@ Use TCP without authentication for localhost IPC.

- Kanata 1.9.0 TCP server does not support authentication
- Connection is localhost-only (127.0.0.1)
- Same security model as other local IPC (Unix sockets, etc.)
- Same security model as other local IPC (Unix sockets, etc.) *(Wrong: loopback TCP has no peer-uid check and is reachable from other users and sandboxed apps, per a source review not yet confirmed live. See ADR-046.)*

## Security Considerations

- Any local process can send commands to Kanata
- This is acceptable for keyboard remapping (low security impact)
- This is acceptable for keyboard remapping (low security impact) *(No longer true for the session runtime: per a source review, the port exposes a keystroke stream and input injection. See ADR-046.)*
- If Kanata adds auth in future versions, we should adopt it

## Implementation
Expand Down
Loading
Loading