Skip to content

Domain#cname? should return false if the value of the CNAME is bad #61

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

Merged
merged 2 commits into from
Oct 25, 2016

Conversation

parkr
Copy link
Contributor

@parkr parkr commented Oct 13, 2016

If you do a dig and you get:

;; QUESTION SECTION:
;sub.example.com.        IN    A

;; ANSWER SECTION:
sub.example.com.    704    IN    CNAME    \@.

...then you should not get a healthy CNAME.

Fixes #60.

/cc @github/pages @antn

@parkr parkr added the bug label Oct 13, 2016
Copy link

@jldec jldec left a comment

Choose a reason for hiding this comment

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

nice!

@@ -199,7 +203,8 @@ def a_record?
# Is this domain's first response a CNAME record?
def cname_record?
return unless dns?
dns.first.class == Net::DNS::RR::CNAME
dns.first.class == Net::DNS::RR::CNAME &&
Domain.valid_domain?(dns.first.cname.to_s)
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe this can be cname.valid_domain? We already instantiate a domain for the cname via https://github.com/github/pages-health-check/blob/master/lib/github-pages-health-check/domain.rb#L210.

Perhaps it'd make more sense to have the CNAME method confirm the class, and then cname? can just look for the existence?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, what do you think of my update in 392d28c, @benbalter?

@parkr parkr merged commit d63446d into master Oct 25, 2016
@parkr parkr deleted the catch-bad-cname-value branch October 25, 2016 21:00
@parkr parkr mentioned this pull request Oct 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants