--- title: "ADR 0065: IsPrivate treats inet_aton spellings and cluster names as private" --- * Status: accepted * Code: [`pkg/vcshost/vcshost.go`](https://github.com/tektoncd/pipelines-as-code/blob/main/pkg/vcshost/vcshost.go), [`pkg/hostpolicy/hostpolicy.go`](https://github.com/tektoncd/pipelines-as-code/blob/main/pkg/hostpolicy/hostpolicy.go) ## Context `hostpolicy` calls `vcshost.IsPrivate` (line 131 of `hostpolicy.go` at the time of writing) when deciding whether a host may be learned automatically, and `vcshost.IsPublic` to let the well known SaaS hosts through. A host that points inside the cluster or at the cloud metadata address must not become trusted just because a payload names it. Reading `IsPrivate` alone, the intent is that such hosts only qualify when an administrator lists them; the policy decision itself lives in `hostpolicy`, which this record does not cover. ## Decision `IsPrivate` returns true for: * IP literals that are loopback, link-local (unicast or multicast), private, or unspecified, after stripping a port, brackets and a trailing dot. * Hostnames made only of decimal, octal or hex numeric labels (`isNumericAddress`). `net.ParseIP` accepts only the canonical dotted quad, while the cgo resolver also accepts `inet_aton` forms, so `127.1`, `0177.0.0.1` and `0x7f.1` would otherwise pass as names. * Names with no dot, `localhost`, anything ending in a suffix of `privateSuffixes` (`.localhost`, `.local`, `.internal`, `.intranet`, `.home.arpa`, `.svc`, `.cluster.local`), or containing `.svc.` so any cluster domain is covered. `IsPublic` is a lookup in `publicHosts` and expects an already normalised host. ## Consequences * The check is lexical: no DNS lookup is made, so a public-looking name that resolves to a private address is not caught here. * `isNumericAddress` is true for any all-numeric label list, so a legitimate host with a purely numeric name is treated as private. * The suffix list is fixed in code; a private zone not on it is not detected.