Development stories

Take caller identity from the connection

KratosForge Editorial · 2026-11-26

Kratos and his wolf inspect a bronze chain passing through a forge doorway socket while a sealed scroll rests on a ledge.
Custom illustration · Verify where a connection comes from before trusting the message it carries.

A desktop API needs to know which local program is calling it. Binding to loopback limits where the server listens; on a shared Windows PC, account ownership still needs its own check. That check depends on trustworthy connection metadata. If a server framework rewrites the caller’s address from a forwarded header, the application can end up asking the operating system about a claim carried in the request.

KratosForge’s merged PR #3342 makes that boundary explicit. Its Uvicorn configuration sets proxy_headers=False, so caller address and port come from the socket. The guard rejects a non-loopback caller before the account check. On Windows, it then uses the existing same-account checker for loopback callers, including routes such as health that do not require a bearer token. Protected routes retain their token and permission checks.

Caller identity and request checks in the pinned Windows API
  1. Socket supplies peer address and port
  2. Loopback gate, then Windows account check
  3. Route-specific request and permission checks

The change also removes a test-specific exception from production behavior. Previously, the guard accepted the in-process client name testclient and skipped its account check. Tests now provide an explicit loopback address and a stand-in account checker. The normal application startup retains the real Windows checker. This makes the test’s simulated identity visible in its setup while keeping the application’s caller rules consistent.

The regression tests cross the network boundary. They start the real server on 127.0.0.1 and send requests over raw sockets with several X-Forwarded-For values. The account-check stand-in records the caller and server ports it receives. An allowing answer yields 200, a denying answer yields 403, and the recorded caller port must be the actual socket port in both cases. Separate checks cover the disabled proxy-header setting and rejection of a non-loopback test caller before the account checker runs.

All 16 tests in the pinned hardening file passed locally. The controlled account-check answers verify the wiring and refusal behavior; they are not a full Windows account-isolation certification. This article describes main commit f51bf8d, not a confirmed Stable rollout. Stable was last updated November 2 when checked on November 26. When reviewing your own local service, trace who populates caller metadata, make test substitutions explicit, and include a real connection in the regression test.

← All publications

Search documentation

Start typing to search all 115 guides.

Search runs in your browser esc to close