Live-stack smoke caught this: every state-changing endpoint emitted an audit event, the INSERT rolled back with invalid input syntax for type inet: \"[::1]\", and the user-facing operation kept working — so audit_log stayed silently empty.
Fixes:
Use net.SplitHostPort which returns IPv6 hosts without brackets.
Add stripBrackets() as belt-and-braces for X-Forwarded-For headers that wrap the IP themselves.
Refs: M4.2
Live-stack smoke caught this: every state-changing endpoint emitted an audit event, the INSERT rolled back with `invalid input syntax for type inet: \"[::1]\"`, and the user-facing operation kept working — so audit_log stayed silently empty.
Fixes:
- Use `net.SplitHostPort` which returns IPv6 hosts without brackets.
- Add `stripBrackets()` as belt-and-braces for X-Forwarded-For headers that wrap the IP themselves.
Refs: M4.2
When a client connects over IPv6 loopback, net/http's RemoteAddr is
'[::1]:port'. The previous clientIP() returned '[::1]' (brackets and
all) which Postgres's INET type rejects with
'invalid input syntax for type inet: "[::1]" (SQLSTATE 22P02)'.
Live local-smoke caught this — every state-changing endpoint emitted
the audit event, the INSERT rolled back, and a warning landed in the
log. The user-facing operation succeeded so the caller never noticed,
but audit_log stayed empty.
Fix:
- Use net.SplitHostPort which returns IPv6 hosts without brackets.
- Add stripBrackets() as a belt-and-braces for X-Forwarded-For
headers that wrap the IP themselves (some proxies do).
Refs: M4.2
sharang
merged commit a37ae1d121 into main2026-05-19 15:09:01 +00:00
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.
Live-stack smoke caught this: every state-changing endpoint emitted an audit event, the INSERT rolled back with
invalid input syntax for type inet: \"[::1]\", and the user-facing operation kept working — so audit_log stayed silently empty.Fixes:
net.SplitHostPortwhich returns IPv6 hosts without brackets.stripBrackets()as belt-and-braces for X-Forwarded-For headers that wrap the IP themselves.Refs: M4.2
When a client connects over IPv6 loopback, net/http's RemoteAddr is '[::1]:port'. The previous clientIP() returned '[::1]' (brackets and all) which Postgres's INET type rejects with 'invalid input syntax for type inet: "[::1]" (SQLSTATE 22P02)'. Live local-smoke caught this — every state-changing endpoint emitted the audit event, the INSERT rolled back, and a warning landed in the log. The user-facing operation succeeded so the caller never noticed, but audit_log stayed empty. Fix: - Use net.SplitHostPort which returns IPv6 hosts without brackets. - Add stripBrackets() as a belt-and-braces for X-Forwarded-For headers that wrap the IP themselves (some proxies do). Refs: M4.2