MCPcopy Index your code
hub / github.com/simstudioai/sim / isPrivateOrReservedIP

Function isPrivateOrReservedIP

apps/sim/lib/core/security/input-validation.ts:808–821  ·  view source on GitHub ↗

* Checks if an IP address is private or reserved (not routable on the public internet) * Uses ipaddr.js for robust handling of all IP formats including: * - Octal notation (0177.0.0.1) * - Hex notation (0x7f000001) * - IPv4-mapped IPv6 (::ffff:127.0.0.1) * - Various edge cases that regex patter

(ip: string)

Source from the content-addressed store, hash-verified

806 * - Various edge cases that regex patterns miss
807 */
808function isPrivateOrReservedIP(ip: string): boolean {
809 try {
810 if (!ipaddr.isValid(ip)) {
811 return true
812 }
813
814 const addr = ipaddr.process(ip)
815 const range = addr.range()
816
817 return range !== 'unicast'
818 } catch {
819 return true
820 }
821}
822
823/**
824 * Validates an Airtable ID (base, table, or webhook ID)

Callers 2

validateHostnameFunction · 0.70
validateExternalUrlFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected