Repository navigation
ADR-046: review the session engine's TCP control port - #1358
Conversation
The engine's unauthenticated port on 127.0.0.1:37001 now fronts the session worker, which holds the user's input permissions. ADR-046 lists what the port accepts and broadcasts, who can reach it, and proposes an owner-checked Unix socket with a peer check. ADR-013 points to it, and the KanataTCPClient security note no longer says the surface is limited to config reloads. Refs #1354 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Review: docs-only change (ADR-046 + comment/ADR-013 updates). No blocking findings. Minor, non-blocking notes:
Index/README status entries are consistent with the ADR-013 header update. |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Review: docs-only ADR + comment change; no blocking findings. The Swift change is a comment edit only, so there is no runtime risk. A few points on the ADR:
No test-coverage concerns, since nothing executable changed. 🤖 Generated with Claude Code |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Review: docs-only ADR plus a doc-comment change. No code behavior changes, so there are no blocking findings. Notes for the author:
No test or code changes are needed for this PR. |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Review: docs-only ADR + a comment update in
No blocking findings. |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… wording Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Review: docs/ADR-only change (plus a doc-comment edit in Findings (all minor, non-blocking):
No correctness, security, or test-coverage issues in the diff itself. ADR README/index entries are consistent with each other. |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Review: docs-only ADR + comment change. No blocking findings. The Swift change only edits a doc comment, so there's no runtime risk. A few minor, non-blocking notes:
Otherwise LGTM: the index/README entries are consistent with the ADR status. |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Review: docs-only ADR plus a comment change in Minor, non-blocking notes:
The ADR and doc edits are consistent with each other, and no code behavior changes. |
|
Review: docs-only ADR plus a doc-comment change, with no code behavior changes. No blocking findings. Minor, non-blocking notes:
README and index entries match each other. LGTM from a correctness standpoint. |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ated Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Review: docs-only ADR plus a comment edit. No blocking findings. Minor, non-blocking notes:
The Swift change is comment-only, so there is no behavior or test impact. |
|
Review: no blocking findings. This PR changes only docs and a doc comment in Notes on ADR-046:
Docs and index updates (ADR-013 note, README, index) are consistent. |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Review: docs/comment-only PR, no blocking findings. The Swift change only rewrites a doc comment in
No code, test, or build risk from this diff. |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Review: docs-only change plus a comment edit in Minor, non-blocking notes:
LGTM from a correctness standpoint. |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Review: docs/comment-only PR, no blocking findings. The only code change is a doc comment in
No correctness, security or test-coverage issues in the diff itself. |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Review (docs/comment-only change; no code behavior touched) No blocking findings. The Minor, non-blocking notes on ADR-046:
🤖 Generated with Claude Code |
A liveness re-check cannot tell a reused PID from the owner. Compare the peer's audit-token PID and PID version against the owner's instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Review: docs-only change (ADR-046 + comment/status updates). No blocking issues. The Swift change is a comment edit only. Minor, non-blocking notes:
The docs are internally consistent. The ADR-013/README/index status updates match, and the ADR-046 links resolve. |
…iscovery Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Review: docs/comment-only PR (ADR-046 + KanataTCPClient note). No code behavior changes. A few actionable points on the ADR text:
No correctness, security, or test-coverage regressions in the code diff (comment-only). Nice, thorough threat model. |
Also keep ADR-013's original 2026-10-31 note for history. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Review (docs/ADR + comment-only Swift change) No code-behavior changes, so no runtime risk. A few doc-accuracy notes:
No blocking findings. |
|
Review: one blocking finding, one minor.
The ADR content and the ADR-013 cross-links look consistent. |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The CGS finding in the previous review is a stale-base artifact. |
|
Review: docs/ADR plus a comment-only Swift change. No blocking issues. Minor points:
Nothing in the diff affects runtime behavior. The ADR's threat model and phased plan look internally coherent. |
…ng fork commit Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Review: docs-only ADR plus a comment change. No blocking findings. The only code change is the doc comment in Minor points:
The threat model is thorough. It also says honestly that the claims come from source reading and need confirming in a lab VM. 🤖 Generated with Claude Code |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Review of #1358 (ADR-046 + KanataTCPClient comment update) No blocking findings. The Swift change is comment-only, and the doc and index updates are consistent with each other (README, index.md and ADR-013 status all match). Minor points for the ADR:
Docs-only change, so no test coverage is needed. |
|
Review: docs-only PR (ADR-046 plus a comment edit in Minor, non-blocking notes:
No code behavior changes, so no test coverage is needed for this PR. |
…n the lab Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Review: docs-only ADR plus a comment change in Minor notes, all non-blocking:
Otherwise the cross-links, the README and index tables, and the ADR-013 status updates are consistent. 🤖 Generated with Claude Code |
…table Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Review: docs/comment-only PR (ADR-046 + KanataTCPClient note). No code behavior changes. No blocking findings. A few minor, actionable notes:
Docs index/README entries are consistent with each other. No tests are affected. |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Review: docs/comment-only PR (ADR-046 + KanataTCPClient note). No code behavior changes. No blocking findings. A few small, actionable notes:
Nothing here affects runtime, tests, or the Swift build (the only Swift change is a doc comment). |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Review: docs-only change plus a comment edit in Actionable notes, all minor:
No correctness, security or performance issues in the diff itself. LGTM from a review standpoint. |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Review: no actionable findings. This PR changes docs and one code comment, with no behavior change. The ADR index, README and ADR-013 status lines agree with each other. The updated Two non-blocking notes:
🤖 Generated with Claude Code |
Adds ADR-046, the review #1354 asked for, and points ADR-013 at it. Docs only, plus a doc comment in
KanataTCPClient.swift. No runtime code changes. Refs #1354; it does not close it: the fix and the release gate are follow-ups once the ADR is accepted.Attack surface today
The session worker binds
127.0.0.1:37001with no authentication. Loopback TCP isn't limited to one user or kept out by the App Sandbox. That means any local process can connect, including another logged-in user's processes and sandboxed apps withnetwork.client. A connection joins the broadcast set before it sends a byte. From the fork atd9085a9, the commitmasterpins, which is onkeypath/bundled(tip54cdba9merges it with an identical tree):KeyInputto every client.RequestCurrentLayerInforeturns the config text. Virtual-key and layer names are readable too.ActOnFakeKeypresses, taps or toggles any virtual key, so a client can trigger key output and macros.ChangeLayerswitches layers.SetMousemoves the pointer.ReloadFile { path }loads any file the worker can read as the active config.push-msgproduces aMessagePush.KanataEventListenerpasses it toActionDispatcher, which can launch apps, open URLs, runsystemandruntime/stopactions, and run scripts if the user enabled them.bind, and KeyPath's clients then trust the squatter'sMessagePush.cmdis compiled out, so the engine itself cannot run shell commands. KeyPath never usesReloadFile,ReloadNext/Prev/NumorSetMouse.Recommendation
Move engine control to an owner-checked Unix socket. It would use the same directory and
getpeereidpattern asRuntimeControlServer, plus a peer-PID check (only the app that launched this worker may connect) and later a code-signature check. Release builds would open no TCP port at all. In the same fork change, drop the unused commands, cap connections and add write timeouts. The CLI's direct TCP use (layer current/switch,service reload) would go through the app's control socket. A per-launch token over TCP was considered and rejected: it doesn't stop port squatting and it adds token-handling code. Narrowing the commands alone was also rejected: KeyPath needsKeyInputandActOnFakeKey, so the keystroke stream and injection would stay. The ADR estimates the cost as roughly 300–500 lines in the fork, a bridge FFI change, two Swift transport sites, and changes toverify-installed-app.shand the docs.Follow-ups (not in this PR)
release-blockerissues are open. Nothing enforces that today.guides/privacy.mdonce the implementation lands.keypath://URL scheme as a local entry point.Verification
./Scripts/review-gate.shran locally: PASS. It had five minor notes. Four of them (wording in ADR-013's body, the passthru bind panic and probe race, the context-integration design that depends on the port, and the description of the privacy guide) are fixed in the second commit. The fifth note was cosmetic wording in the doc comment; I fixed that too.🤖 Generated with Claude Code