KimNorgaard / validates_hostname

Extension to ActiveRecord::Base for validating hostnames and domain names
MIT License
38 stars 12 forks source link

Fix the numeric hostname check #7

Closed lupine closed 7 years ago

lupine commented 7 years ago

Hi,

Thanks for this great gem! We're using it in GitLab EE and I think we've discovered a bug in its evaluation of numeric-only hostnames: a label like `0x10' is incorrectly interpreted as being all-numeric, leading to this bug report: https://gitlab.com/gitlab-org/gitlab-ee/issues/827

I believe this PR will fix the issue while adding a spec to fix it, but unfortunately I wasn't able to get the test suite running from a fresh bundle install && bundle exec rake spec, so I haven't been able to verify it myself.

Do you know what ruby and gem versions the test suite will run against?

KimNorgaard commented 7 years ago

Hi,

Nice catch.

The tests are old and written when rails was version 3-something. I have updated them to run against rails 5, ruby 2.3 and rspec >= 3.0. They pass now using rake spec or bundle exec rake spec.

I will merge the PR and bump the version.

Thank you for the contribution :)

lupine commented 7 years ago

Thanks for merging! As soon as you've bumped that version, I'll update our side to use it :-)

lupine commented 7 years ago

https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/982 :thumbsup: