~sircmpwn/sr.ht-dev

meta.sr.ht: API: Don't attempt to parse IPv6 as a hostname v1 APPLIED

Galen Abell: 1
 API: Don't attempt to parse IPv6 as a hostname

 1 files changed, 1 insertions(+), 1 deletions(-)
#639192 alpine.yml success
#639193 archlinux.yml success
#639194 debian.yml success
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~sircmpwn/sr.ht-dev/patches/26985/mbox | git am -3
Learn more about email & git

[PATCH meta.sr.ht] API: Don't attempt to parse IPv6 as a hostname Export this patch

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.
---
 api/graph/resolver.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/api/graph/resolver.go b/api/graph/resolver.go
index c18a8fe..8cc7e93 100644
--- a/api/graph/resolver.go
+++ b/api/graph/resolver.go
@@ -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)
-- 
2.32.0
meta.sr.ht/patches: SUCCESS in 3m18s

[API: Don't attempt to parse IPv6 as a hostname][0] from [Galen Abell][1]

[0]: https://lists.sr.ht/~sircmpwn/sr.ht-dev/patches/26985
[1]: mailto:galen@galenabell.com

✓ #639193 SUCCESS meta.sr.ht/patches/archlinux.yml https://builds.sr.ht/~sircmpwn/job/639193
✓ #639194 SUCCESS meta.sr.ht/patches/debian.yml    https://builds.sr.ht/~sircmpwn/job/639194
✓ #639192 SUCCESS meta.sr.ht/patches/alpine.yml    https://builds.sr.ht/~sircmpwn/job/639192
Thanks!

To git@git.sr.ht:~sircmpwn/meta.sr.ht
   699f8ae..6a64ac6  master -> master