Found by mobile-support while working on #73.
## Problem
- `clientIP()` (internal/server/helpers.go) returns the **leftmost** `X-Forwarded-For` entry.
- orca-proxy (`crates/orca-proxy/src/forward.rs`) *appends* the peer it saw and documents the **rightmost** entry as the authoritative one.
- So today the caller chooses every `source_ip` the registry records in its audit, licence and usage rows, by sending its own `X-Forwarded-For`.
- A side effect: the column is `INET`, so a non-IP leftmost value likely makes the insert fail.
## Fix
- Take the rightmost entry, i.e. the one orca-proxy appended.
- More generally, the entry that sits a configured number of trusted hops from the right.
- Accept it only when `net.ParseIP` succeeds; otherwise fall back to `RemoteAddr`.
- Add tests for a spoofed leftmost entry and a junk entry.
Related: #73 (`source_ip` relayed by products), orca-platform #88.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Found by mobile-support while working on #73.
Problem
clientIP()(internal/server/helpers.go) returns the leftmostX-Forwarded-Forentry.crates/orca-proxy/src/forward.rs) appends the peer it saw and documents the rightmost entry as the authoritative one.source_ipthe registry records in its audit, licence and usage rows, by sending its ownX-Forwarded-For.INET, so a non-IP leftmost value likely makes the insert fail.Fix
net.ParseIPsucceeds; otherwise fall back toRemoteAddr.Related: #73 (
source_iprelayed by products), orca-platform #88.🤖 Generated with Claude Code