go-openapi / strfmt

openapi toolkit common string formats

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hostname matching doesn't conform to modern hostname patterns

jimmystewpot opened this issue · comments

Hello,

I have been using this package/library through the go swagger tooling. Recently have had an increase in complaints where customers have been unable to validate their domains. When I investigated I found

https://github.com/go-openapi/strfmt/blob/master/default.go#L33

Which references various RFC's. I can appreciate standards however these seem to be slightly out of touch with modern usage of the term Hostname. There are thousands that exist globally which start with an integer. I spent time reading through the various RFCs and found that there are numerous that Supercede the ones listed in the source.

I am happy to supply a PR with the fix included however I wanted to discuss further as RFC's can be an emotional topic. Here is a good thread that lists many of the competing RFCs https://serverfault.com/questions/638260/is-it-valid-for-a-hostname-to-start-with-a-digit

Here is a fork with the fix included https://github.com/jimmystewpot/strfmt/blob/improve_hostname_regex/default.go#L52

Keen to discuss further,

Thanks.