Skip to content

feat(api): say which machine a request came from, and which app it looks like - #90

Merged
fylorn merged 1 commit into
mainfrom
feat/request-source
Sep 22, 2026
Merged

fylorn merged 1 commit into
mainfrom
feat/request-source

Conversation

@fylorn

@fylorn fylorn commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Every request record, and every security log entry, now says which machine the request came from when it was not this one, and carries the app the headers point to.

Why

The desktop app showed the gateway key's name where it said "client". With keys named after apps, that read as "Codex sent this", which it does not mean: a key can be called anything, several apps can share one, and once the gateway is opened to the local network, several machines can share one too. The security log in particular has to answer "who sent this credential out", and the key alone cannot.

What changes

  • peer: the address on the other end of the connection. It cannot be forged. Loopback is not recorded, because nearly every request comes from this machine. The gateway already read it for allow_from; it now travels on RequestStarted and LocallyAnswered, into requests.peer (schema 15), and out through HistoryRow and SecurityEventView.
  • client_hint: the app the request headers point to, which core already recorded but never handed out. It can be forged and is for display only, as before; the identity is still the key. It now also comes out through HistoryRow and SecurityEventView, and locally answered probes record it too; they used to drop it.

Additive; CONTROL_API_VERSION unchanged.

Tests

  • peer_of drops loopback, including the IPv4-mapped form a dual-stack listener sees, and keeps a LAN address.
  • The store round-trips peer, an old row reads as none rather than "this machine", and the migration test drops the new column in its simulated old database.
  • The security log returns the key, the hint and the source for an entry, and no source for a local one.
  • cargo test --workspace (1511 passed), clippy -D warnings, fmt, and scripts/smoke.sh (51 passed).

🤖 Generated with Claude Code

…oks like

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@fylorn
fylorn merged commit 41dbd41 into main Sep 22, 2026
1 check passed
@fylorn
fylorn deleted the feat/request-source branch September 22, 2026 02:45
@fylorn fylorn mentioned this pull request Sep 22, 2026
fylorn added a commit that referenced this pull request Sep 22, 2026
Requests say which machine they came from and which app they look like
(#90). Additive; CONTROL_API_VERSION unchanged.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant