feat(audit): API-key writes carry the caller's address to the registry #567

Merged
sharang merged 1 commits from feat/audit-client-ip into main 2026-10-14 09:33:25 +00:00
Owner

Audit entries for API-key writes recorded the agent's container address (172.17.0.6 on stage), because the registry stores the peer of its own request. With this change they carry the caller's address.

  • The API host's proxy puts the caller's address in X-BP-Client-IP, overwriting anything the client sent. That proxy change is a separate orca-platform PR on pruefwerk-stage/api-proxy.conf.
  • audit_delegated_writes reads the header for API-key requests only and keeps it only if it parses as an IP address, because the registry stores it as Postgres inet and garbage would sink the whole entry.
  • AuditEntry.source_ip is sent as source_ip and skipped when empty.
  • The registry ignores the field until tenant-registry accepts it (separate PR), so the deploy order doesn't matter.
  • The address is informational: nothing decides on it.
  • Support writes via the dashboard still show the dashboard's address.

Tests: unit test for the header parse (v4, v6, a list, junk, missing); tests/api_key_access.rs checks source_ip in the posted audit entry. Not run locally (RAM); CI runs them.

🤖 Generated with Claude Code

https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p

Audit entries for API-key writes recorded the agent's container address (172.17.0.6 on stage), because the registry stores the peer of its own request. With this change they carry the caller's address. - The API host's proxy puts the caller's address in `X-BP-Client-IP`, overwriting anything the client sent. That proxy change is a separate orca-platform PR on `pruefwerk-stage/api-proxy.conf`. - `audit_delegated_writes` reads the header for **API-key requests only** and keeps it only if it parses as an IP address, because the registry stores it as Postgres `inet` and garbage would sink the whole entry. - `AuditEntry.source_ip` is sent as `source_ip` and skipped when empty. - The registry ignores the field until tenant-registry accepts it (separate PR), so the deploy order doesn't matter. - The address is informational: nothing decides on it. - Support writes via the dashboard still show the dashboard's address. Tests: unit test for the header parse (v4, v6, a list, junk, missing); `tests/api_key_access.rs` checks `source_ip` in the posted audit entry. Not run locally (RAM); CI runs them. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
sharang added 1 commit 2026-10-14 08:51:19 +00:00
feat(audit): API-key writes carry the caller's address to the registry
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Deploy Agent (pull_request) Skipped
CI / Deploy Dashboard (pull_request) Skipped
CI / Deploy Docs (pull_request) Skipped
CI / Deploy MCP (pull_request) Skipped
CI / Check (pull_request) Successful in 9m11s
40b0e3e756
Audit entries for API-key writes showed the agent's container address,
because the registry records the peer of its own request. The API host's
proxy now puts the caller's address in X-BP-Client-IP (orca-platform), and
the agent sends it as source_ip for key writes only, when it parses as an
IP address. It is informational; nothing decides on it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
sharang merged commit 5ce496303d into main 2026-10-14 09:33:25 +00:00
sharang deleted branch feat/audit-client-ip 2026-10-14 09:33:25 +00:00
Sign in to join this conversation.