~sircmpwn/meta.sr.ht

6a64ac6a87be296f0a15e4a4b4b264bf54421fe0 — Galen Abell a month ago 699f8ae 0.56.24
API: Don't attempt to parse IPv6 as a hostname

Fixes a crash that occurs when the remote address is an IPv6 address.
The address should only be parsed as a hostport string if it also cannot
be parsed as a normal IP address.
1 files changed, 1 insertions(+), 1 deletions(-)

M api/graph/resolver.go
M api/graph/resolver.go => api/graph/resolver.go +1 -1
@@ 58,7 58,7 @@ func recordAuditLog(ctx context.Context, eventType, details string) {
	database.WithTx(ctx, nil, func(tx *sql.Tx) error {
		var err error
		addr := server.RemoteAddr(ctx)
		if strings.ContainsRune(addr, ':') {
		if strings.ContainsRune(addr, ':') && net.ParseIP(addr) == nil {
			addr, _, err = net.SplitHostPort(addr)
			if err != nil {
				panic(err)