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
Add hostname validation #42553
Add hostname validation #42553
Conversation
|
Codenotify: Notifying subscribers in CODENOTIFY files for diff a44b3b6...c89e6ea.
|
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.
Thanks!
| // ValidateRemoteAddr validates if the input is a valid IP or a valid hostname. | ||
| // It validates the hostname by attempting to resolve it. | ||
| func ValidateRemoteAddr(raddr string) bool { | ||
| host, port, err := net.SplitHostPort(raddr) |
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.
What if err != nil here?
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.
Then we don't use anything from it. That means that raddr is probably just an IP or just a hostname.
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.
Cool, this looks good to me and the tests help with confidence.
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.
Good job!
Add functionality that validates hostnames and IP addresses. Validate gitolite addresses.
Test plan