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

check for underscore for https #147

Merged
merged 6 commits into from
Oct 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion lib/github-pages-health-check/domain.rb
Original file line number Diff line number Diff line change
Expand Up @@ -449,8 +449,11 @@ def enforces_https?
def https_eligible?
# Can't have any IP's which aren't GitHub's present.
return false if non_github_pages_ip_present?
# Must be a CNAME or point to our IPs.

# Can't have underscores in the domain name (Let's Encrypt does not allow it)
return false if host.include?("_")
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this invalidate the domain name as well, or just HTTPS eligibility? Does GitHub have many customer custom domains with underscores?

Copy link
Contributor

Choose a reason for hiding this comment

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

Hello there!

We do have people on HTTP only and with a _ in their domain name unfortunately 🙈. Some are using Cloudflare which does issue certs, but Let's Encrypt does not.

Copy link
Contributor

Choose a reason for hiding this comment

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

Gotta love the edge cases! 😄

Copy link
Contributor

Choose a reason for hiding this comment

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

We are full of them!


# Must be a CNAME or point to our IPs.
# Only check the one domain if a CNAME. Don't check the parent domain.
return true if cname_to_github_user_domain?

Expand Down
2 changes: 1 addition & 1 deletion lib/github-pages-health-check/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

module GitHubPages
module HealthCheck
VERSION = "1.18.0"
VERSION = "1.18.1"
end
end
6 changes: 6 additions & 0 deletions spec/github_pages_health_check/domain_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1042,6 +1042,12 @@

it { is_expected.to be_https_eligible }

context "with underscore domain" do
let(:domain) { "foo_bar.com" }

it { is_expected.not_to be_https_eligible }
end

context "with bad CAA records" do
let(:caa_domain) { "digicert.com" }
before(:each) { allow(subject.send(:caa)).to receive(:query) { [caa_packet] } }
Expand Down