File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -120,9 +120,12 @@ export async function resolveAndValidateHost(url: string): Promise<boolean> {
120120 }
121121
122122 try {
123- // Resolve to check all returned IPs
124- const { address } = await lookup ( hostname )
125- return ! isPrivateIP ( address )
123+ // Resolve with { all: true } to get every A/AAAA record. A hostname can
124+ // have multiple records; an attacker could mix a public IP with a private
125+ // one. If any resolved IP is private/reserved, reject the entire request.
126+ const results = await lookup ( hostname , { all : true } )
127+ if ( results . length === 0 ) return false
128+ return results . every ( result => ! isPrivateIP ( result . address ) )
126129 } catch {
127130 // DNS resolution failed — block the request
128131 return false
You can’t perform that action at this time.
0 commit comments