PAC-C011 · dnsdomainis-short-pattern

Very short or trailing-dot dnsDomainIs pattern

medium · Correctness

Patterns like ".uk." (trailing dot) or ".ab" are suspicious. A pattern with a trailing dot matches only when the address itself was typed with a trailing dot; a two-letter suffix without a label is a TLD or a typo.

Why it matters

Chrome, Edge, Firefox and Windows (WinHTTP and WinINet) pass host exactly as the address gives it, with or without a final dot (lab, 2026-10-15). An ordinary address has no final dot, so dnsDomainIs(host, ".uk.") is false for it. The reverse also holds: when someone opens http://intranet.corp.example./, the script gets intranet.corp.example., and both dnsDomainIs(host, ".corp.example") and shExpMatch(host, "*.corp.example") are false, so the request takes the default route of the file. If a rule must also catch such addresses, remove a final dot from host first.

A pattern of only a few characters (.ab, .x) is either a TLD match (PAC-X005) or a truncated domain. Both make the branch dead or far too broad.

How to fix

Use a full domain suffix such as ".corp.example" without a trailing dot. To treat "host." like "host", start with `if (host.charAt(host.length - 1) == ".") host = host.slice(0, -1);`.

Examples

Bad

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

Good

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

Engine behaviour

EngineBehaviourSource
chromiumA trailing dot in the address is kept in host and in the host part of url (http://case-dot.example.test.:8090/P arrives as host case-dot.example.test.); dnsDomainIs(host, ".example.test") is then false. In the source, url/url_canon_host.cc keeps the final dot and services/proxy_resolver/pac_js_library.h dnsDomainIs is a plain suffix comparison.lab, verified 2026-10-15
firefoxA trailing dot is kept in host and url, as in Chromium; dnsDomainIs(host, ".example.test") is false. In the source, netwerk/base/nsPACMan.cpp takes GetAsciiHost(), which keeps the dot.lab, verified 2026-10-15
winhttpA trailing dot is kept in host and url; dnsDomainIs(host, ".example.test") is false.lab, verified 2026-10-15
wininetA trailing dot is kept in host and url, in a direct proxy query and in real requests of a WinINet program; dnsDomainIs(host, ".example.test") is false.lab, verified 2026-10-15

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

  • dnsDomainIs(): True if host ends with domain. A plain string suffix comparison, no DNS lookup.

Related rules

References

Last updated: