enforce port restrictions against requests that happen to be missing the port

This commit is contained in:
Hazelnoot 2025-05-13 22:22:40 -04:00
parent 4ddb16aa9a
commit ebd4ccdd55

View file

@ -32,7 +32,7 @@ export function isPrivateIp(allowedPrivateNetworks: PrivateNetwork[] | undefined
for (const { cidr, ports } of allowedPrivateNetworks ?? []) { for (const { cidr, ports } of allowedPrivateNetworks ?? []) {
if (cidr[0].kind() === parsedIp.kind() && parsedIp.match(cidr)) { if (cidr[0].kind() === parsedIp.kind() && parsedIp.match(cidr)) {
if (port == null || ports == null || ports.includes(port)) { if (ports == null || (port != null && ports.includes(port))) {
return false; return false;
} }
} }