Skip to content
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

fix: Remove underscore from RFC-1123 based regex #912

Merged
merged 3 commits into from May 1, 2022

Conversation

sdillen
Copy link
Contributor

@sdillen sdillen commented Mar 15, 2022

RFC-1123 is based on RFC-952, which doesn't allow underscores. RFC-1123
must be therefore implemented with the same constraint to disallow
underscores in host names.

Fixes Or Enhances

  • Regex that implement RFC-1123 don't allow underscores anymore

Make sure that you've checked the boxes below before you submit PR:

  • Tests exist or have been written that cover this particular change.

@go-playground/validator-maintainers

RFC-1123 is based on RFC-952, which doesn't allow underscores. RFC-1123
must be therefore implemented with the same constraint to disallow
underscores in host names.
@sdillen sdillen requested a review from a team as a code owner March 15, 2022 10:17
@coveralls
Copy link

coveralls commented Mar 15, 2022

Coverage Status

Coverage remained the same at 75.26% when pulling d8e8d49 on sdillen:fix/rfc1123 into aea8782 on go-playground:master.

Copy link
Member

@zemzale zemzale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @sdillen

Could you add a failing test case for the hostname that would contain the _ so we have that covered and we wouldn't have regression in the future?

It should be somewhere in validator_test.go test case TestHostnameRFC1123Validation

Add test case that covers constraint on underscores.
@sdillen
Copy link
Contributor Author

sdillen commented Mar 15, 2022

There is now one failing test case for each TestHostnameRFC1123Validation and TestHostnameRFC1123AliasValidation.

Copy link
Member

@zemzale zemzale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Looks good now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants