diff --git a/packages/components/nodes/agentflow/HTTP/HTTP.ts b/packages/components/nodes/agentflow/HTTP/HTTP.ts index e18751db0..5a6920edb 100644 --- a/packages/components/nodes/agentflow/HTTP/HTTP.ts +++ b/packages/components/nodes/agentflow/HTTP/HTTP.ts @@ -233,14 +233,21 @@ class HTTP_Agentflow implements INode { } private isDeniedIP(ip: string, denyList: string[]): void { + const parsedIp = ipaddr.parse(ip) for (const entry of denyList) { if (entry.includes('/')) { try { - if (ipaddr.parse(ip).match(ipaddr.parseCIDR(entry))) throw new Error(`IP given is in deny list: ${ip}`) + const [range, _] = entry.split('/') + const parsedRange = ipaddr.parse(range) + if (parsedIp.kind() === parsedRange.kind()) { + if (parsedIp.match(ipaddr.parseCIDR(entry))) { + throw new Error('Access to this host is denied by policy.') + } + } } catch (error) { throw new Error(`isDeniedIP: ${error}`) } - } else if (ip === entry) throw new Error(`IP given is in deny list: ${ip}`) + } else if (ip === entry) throw new Error('Access to this host is denied by policy.') } } @@ -253,8 +260,6 @@ class HTTP_Agentflow implements INode { const hostname = urlObj.hostname - if (httpDenyList.includes(hostname)) throw new Error(`Hostname given is in deny list: ${hostname}`) - if (ipaddr.isValid(hostname)) { this.isDeniedIP(hostname, httpDenyList) } else {