PAC-E010 · isinnet-invalid-arguments

isInNet called with an invalid address, mask or argument count

high · Errors and robustness

The network or mask literal is not a dotted-quad IPv4 address, the mask is not contiguous, or the call has fewer than three arguments. The comparison is then false for every host.

Why it matters

isInNet(host, pattern, mask) only works with two syntactically valid IPv4 literals. Typos such as 295.255.255.240, 10.0.0 or 255:255.255.0 do not raise an error in most engines; the function just returns false and the DIRECT branch for the internal network silently stops matching. The engines disagree about such calls: Chrome, Edge and Firefox check the pattern and mask first and return false, while pactester (pacparser) and Windows (WinHTTP) do not check them. There, isInNet(ip, "10.0.0.0/8", "255.0.0.0") (pactester only), a short mask such as 255.255.0 and a prefix length such as 8 can be true, so a pactester test passes while the browsers return false (lab, 2026-10-11). Non-contiguous masks (255.0.255.0) are accepted by every engine and compared bit by bit, which produces surprising matches. With only two arguments the browsers return false, and pactester and Windows throw an error that ends the evaluation. IPv6 literals are not valid arguments for the v1 function (PAC-K014). Leading zeros such as 010.0.0.0 pass the browsers' check but are read differently on Windows; PAC-C031 reports them.

How to fix

Use four decimal octets 0-255 for both address and mask; the mask must be a run of 1-bits followed by 0-bits (e.g. 255.240.0.0).

Examples

Bad

function FindProxyForURL(url, host) {
  if (isInNet(host, "10.20.30.40", "295.255.255.240")) {
    return "DIRECT";
  }
  return "PROXY proxy.corp.example:8080";
}
Open bad example in checker

Good

function FindProxyForURL(url, host) {
  if (isInNet(host, "10.20.30.32", "255.255.255.240")) {
    return "DIRECT";
  }
  return "PROXY proxy.corp.example:8080";
}
Open good example in checker

Engine behaviour

EngineBehaviourSource
chromiumisInNet returns false when the network or mask literal is not a valid dotted quad (isValidIpAddress check), also with only two arguments; non-contiguous masks are accepted and applied bitwise.lab, verified 2026-10-11 · ref
firefoxSame check as Chromium; invalid pattern or mask and a missing mask give false.lab, verified 2026-10-11
pacparserNo check of pattern or mask, so a CIDR network or a short mask can still match; a missing mask throws.lab, verified 2026-10-11 · ref
winhttpOwn implementation without a check of the mask; answers short masks, leading zeros and a missing mask differently from the browsers.lab, verified 2026-10-11

Source: code = read in the engine's source, doc = vendor documentation, lab = observed in a lab run, expert = practitioner knowledge, not yet verified.

The PAC functions this rule is about

  • isInNet(): True if the IP address of host is in the network pattern/mask. Resolves host via DNS if it is not an IP literal.

Related rules

References

Last updated: