• alfadb's avatar
    fix(gateway): sanitize stream errors to avoid leaking infrastructure topology · d78478e8
    alfadb authored
    (*net.OpError).Error() concatenates Source/Addr fields, so the previous
    disconnectMsg surfaced internal source IP/port and upstream server address
    to clients via SSE error frames and UpstreamFailoverError.ResponseBody
    (reported by @Wei-Shaw on PR #2066).
    
    - Add sanitizeStreamError that maps known errors (io.ErrUnexpectedEOF,
      context.Canceled, syscall.ECONNRESET/EPIPE/ETIMEDOUT/...) to fixed
      descriptions and falls back to a generic placeholder, with an explicit
      *net.OpError branch that drops Source/Addr fields entirely.
    - Use sanitized message in client-facing disconnectMsg; full ev.err is
      still preserved in the existing operator log line for diagnosis.
    - Tests cover net.OpError redaction, the failover ResponseBody path, and
      every known sanitized error mapping.
    d78478e8
gateway_service.go 318 KB