Documentation
¶
Overview ¶
Package sourcehost compares the host a Git or HTTPS source names with a host something else grants: the host key of a credential Secret, or an entry of a source policy's allowedGitHosts or allowedHTTPSHosts.
A host is compared as ASCII. url.Parse accepts UTF-8 in a host and decodes a percent-escaped one, and Go's HTTP transport dials such a host by its IDNA form: https://g%C4%B0thub.com/, "g", U+0130 and "thub.com", dials xn--github-qyd.com. A comparison that folds Unicode case reads that host as github.com, since strings.ToLower maps U+0130 to "i", and holds a grant for one name to a server under another. So a host that holds a byte outside printable ASCII is refused, and an internationalized name is written in its xn-- form.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotASCII = errors.New("write an internationalized name in its xn-- form")
ErrNotASCII is the refusal of a host that holds a byte outside printable ASCII, matched with errors.Is.
Functions ¶
func Authority ¶
Authority is the host[:port] a source URL names, as url.Parse reads it, percent escapes decoded. It refuses a URL url.Parse refuses and a host that is not printable ASCII.
func CheckASCII ¶
CheckASCII refuses a host[:port] that holds a byte outside printable ASCII, naming it with every such byte escaped.
Types ¶
This section is empty.