This issue is a response to a discussion in another pr, see this thread for details: #9542 (comment)
Hostnames are managed in different ways, they can either be part of a ORG/REPO string, GH_HOST environment variable, or be set in the config file. There is no general validation of that validity of the actual hostname, and this can lead to inconsistent error reporting.
We should make sure that hostnames are validated centrally (e.g. in auth.DefaultHost() by calling ghainstance.HostnameValidator()). For commands that are accepting hosts via different means, should also call ghainstanceHostnameValidator() before using the host.
An example of where host validation does not happen:
$ GH_HOST='foo$bar.com' gh issue list
none of the git remotes configured for this repository correspond to the GH_HOST environment variable. Try adding a matching remote or unsetting the variable.
Expected here would be a message similar to foo$bar.com is not a valid hostname.
This issue is a response to a discussion in another pr, see this thread for details: #9542 (comment)
Hostnames are managed in different ways, they can either be part of a
ORG/REPOstring,GH_HOSTenvironment variable, or be set in the config file. There is no general validation of that validity of the actual hostname, and this can lead to inconsistent error reporting.We should make sure that hostnames are validated centrally (e.g. in
auth.DefaultHost()by callingghainstance.HostnameValidator()). For commands that are accepting hosts via different means, should also callghainstanceHostnameValidator()before using the host.An example of where host validation does not happen:
Expected here would be a message similar to
foo$bar.com is not a valid hostname.