From 7c0fb16fdb8b2ff2ea9bf5c4b7b0a6f5321d03fe Mon Sep 17 00:00:00 2001 From: dumbmoron Date: Sat, 12 Oct 2024 11:24:29 +0000 Subject: [PATCH] api/keys: fix prefix size calculation for individual ipv6 addresses --- api/src/security/api-keys.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/api/src/security/api-keys.js b/api/src/security/api-keys.js index eee48da3..72063099 100644 --- a/api/src/security/api-keys.js +++ b/api/src/security/api-keys.js @@ -99,7 +99,9 @@ const formatKeys = (keyData) => { if (data.ips) { formatted[key].ips = data.ips.map(addr => { if (ip.isValid(addr)) { - return [ ip.parse(addr), 32 ]; + const parsed = ip.parse(addr); + const range = parsed.kind() === 'ipv6' ? 128 : 32; + return [ parsed, range ]; } return ip.parseCIDR(addr);