(host: string)
| 53 | ]) |
| 54 | |
| 55 | function isPrivateIPv4(host: string): boolean { |
| 56 | const match = host.match(/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/) |
| 57 | if (!match) return false |
| 58 | const octets = match.slice(1, 5).map(Number) as [number, number, number, number] |
| 59 | if (octets.some((o) => o < 0 || o > 255)) return false |
| 60 | const [a, b] = octets |
| 61 | if (a === 10) return true |
| 62 | if (a === 172 && b >= 16 && b <= 31) return true |
| 63 | if (a === 192 && b === 168) return true |
| 64 | if (a === 127) return true |
| 65 | if (a === 169 && b === 254) return true |
| 66 | if (a === 0) return true |
| 67 | return false |
| 68 | } |
| 69 | |
| 70 | export function assertSafeZoomInfoUrl(rawUrl: string, label: string): URL { |
| 71 | let parsed: URL |
no outgoing calls
no test coverage detected