-
Notifications
You must be signed in to change notification settings - Fork 84
Fix valid domain regex #57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Based on https://gist.github.com/dperini/729294 Stripped the following checks: - protocol (http, ftp) - short syntax (//) - basic auth (user:pass) - requirement for TLD (\. made optional) - port number (:port) - resource path (/path, #resource-path)
It doesn't seem to match any IP addresses. Of course, the generated certificates also don't support IP addresses, so maybe it's a good thing for it to fail early when an IP address is provided as hostname /cc @zetlen |
@Js-Brecht If we don't want to match IP addresses, we can probably just add the localhost support to the existing regex? You had mentioned IP addresses in #56 |
Could probably switch the regex to |
I guess I did 😆. I think it will need to be done eventually, so maybe it will be good to have something on standby. Currently, though, the certificates generated do not use IP SANs. Didn't really think about that when I said it.
Since, technically, domain names can have numbers in them, it makes sense to keep the That regexp works, but it also matches on just the first octet of an IP address like Maybe there should be a separate regex to match IP addresses, so that they can be matched prior to domain name validation? Then a friendly error could be generated to indicate that IP addresses aren't supported at the moment? Later, when they are supported, the condition could be changed to accept the IP, and a monolithic regular expression wouldn't have to be picked apart to ensure compatibility. |
@Js-Brecht The regex no longer matches the octets of any IP. I also added a quick IPv4 regex and check that throws an error if an IP is provided. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just something minor
Co-authored-by: Jeremy Albright <1935258+Js-Brecht@users.noreply.github.com>
Doh! Thanks, just did it quickly with the inline editor. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ping @zetlen @davewasmer |
Is there any movement on the issue? |
@Js-Brecht Is there any way to move this along? This is rather inconvenient to deal with at the moment. |
I'm so sorry, folks! @Js-Brecht I have been on vacation for a week, but I'll look at this right now. |
Confirmed locally, this fixes the issue. |
Welcome back @zetlen! Thanks for the merge 🚀; I'm sure everybody will be glad. |
@stramel @Js-Brecht Published |
Thank you @zetlen! Sorry for bugging you on vacation! |
Ping @zetlen @davewasmer |
Fixes #56
Based on https://gist.github.com/dperini/729294
Stripped the following checks from the above gist regex:
Should now work for IPs,
localhost
, and valid domainsUPDATE: Since the generated certificates don't support IP addresses, I reverted the change and just simply modified the Regex to handle
localhost
and make it case-insensitive./cc @Js-Brecht