axios+telemetry cleanup
This commit is contained in:
@@ -1,7 +1,12 @@
|
||||
import type { AddressFamily, LookupAddress as AxiosLookupAddress } from 'axios'
|
||||
import { lookup as dnsLookup } from 'dns'
|
||||
import { isIP } from 'net'
|
||||
|
||||
export type AddressFamily = 4 | 6
|
||||
export type LookupAddress = {
|
||||
address: string
|
||||
family: AddressFamily
|
||||
}
|
||||
|
||||
/**
|
||||
* SSRF guard for HTTP hooks.
|
||||
*
|
||||
@@ -210,16 +215,14 @@ function extractMappedIPv4(addr: string): string | null {
|
||||
* rebinding window between validation and connection.
|
||||
*
|
||||
* IP literals in the hostname are validated directly without DNS.
|
||||
*
|
||||
* Signature matches axios's `lookup` config option (not Node's dns.lookup).
|
||||
*/
|
||||
export function ssrfGuardedLookup(
|
||||
hostname: string,
|
||||
options: object,
|
||||
options: any,
|
||||
callback: (
|
||||
err: Error | null,
|
||||
address: AxiosLookupAddress | AxiosLookupAddress[],
|
||||
family?: AddressFamily,
|
||||
address: any,
|
||||
family?: number,
|
||||
) => void,
|
||||
): void {
|
||||
const wantsAll = 'all' in options && options.all === true
|
||||
|
||||
Reference in New Issue
Block a user