-
Notifications
You must be signed in to change notification settings - Fork 43
Improved support for internationalised domains #102
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
Changes from all commits
c8a1e16
67aa75b
591019d
05cd822
228d097
cd45272
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -543,6 +543,30 @@ | |
expect(subject).to be_valid | ||
end | ||
end | ||
|
||
context "domains with unicode encoding" do | ||
let(:domain) { "dómain.example.com" } | ||
let(:cname) { "sómething.example.com" } | ||
let(:headers) { { :server => "GitHub.com" } } | ||
before(:each) { allow(subject).to receive(:dns) { [cname_packet] } } | ||
|
||
it "doesn't error out on domains with unicode encoding" do | ||
expect(subject).to be_served_by_pages | ||
expect(subject).to be_valid | ||
end | ||
end | ||
|
||
context "domains with punycode encoding" do | ||
let(:domain) { "xn--dmain-0ta.example.com" } | ||
let(:cname) { "xn--smething-v3a.example.com" } | ||
let(:headers) { { :server => "GitHub.com" } } | ||
before(:each) { allow(subject).to receive(:dns) { [cname_packet] } } | ||
|
||
it "doesn't error out on domains with punycode encoding" do | ||
expect(subject).to be_served_by_pages | ||
expect(subject).to be_valid | ||
end | ||
end | ||
end | ||
|
||
context "not served by pages" do | ||
|
@@ -836,13 +860,27 @@ | |
context "A records pointed to old IPs" do | ||
let(:ip) { "192.30.252.153" } | ||
before(:each) { allow(subject).to receive(:dns) { [a_packet] } } | ||
before(:each) { allow(subject.send(:caa)).to receive(:query) { [a_packet] } } | ||
|
||
it { is_expected.not_to be_https_eligible } | ||
|
||
context "with unicode encoded domain" do | ||
let(:domain) { "dómain.example.com" } | ||
|
||
it { is_expected.not_to be_https_eligible } | ||
end | ||
|
||
context "with punycode encoded domain" do | ||
let(:domain) { "xn--dmain-0ta.example.com" } | ||
|
||
it { is_expected.not_to be_https_eligible } | ||
end | ||
end | ||
|
||
context "A records pointed to new IPs" do | ||
let(:ip) { "185.199.108.153" } | ||
before(:each) { allow(subject).to receive(:dns) { [a_packet] } } | ||
before(:each) { allow(subject.send(:caa)).to receive(:query) { [a_packet] } } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is required so that we return the |
||
|
||
it { is_expected.to be_https_eligible } | ||
|
||
|
@@ -859,11 +897,52 @@ | |
|
||
it { is_expected.to be_https_eligible } | ||
end | ||
|
||
context "with unicode encoded domain" do | ||
let(:domain) { "dómain.example.com" } | ||
|
||
it { is_expected.to be_https_eligible } | ||
|
||
context "with bad CAA records" do | ||
let(:caa_domain) { "digicert.com" } | ||
before(:each) { allow(subject.send(:caa)).to receive(:query) { [caa_packet] } } | ||
|
||
it { is_expected.not_to be_https_eligible } | ||
end | ||
|
||
context "with good CAA records" do | ||
let(:caa_domain) { "letsencrypt.org" } | ||
before(:each) { allow(subject.send(:caa)).to receive(:query) { [caa_packet] } } | ||
|
||
it { is_expected.to be_https_eligible } | ||
end | ||
end | ||
|
||
context "with punycode encoded domain" do | ||
let(:domain) { "xn--dmain-0ta.example.com" } | ||
|
||
it { is_expected.to be_https_eligible } | ||
|
||
context "with bad CAA records" do | ||
let(:caa_domain) { "digicert.com" } | ||
before(:each) { allow(subject.send(:caa)).to receive(:query) { [caa_packet] } } | ||
|
||
it { is_expected.not_to be_https_eligible } | ||
end | ||
|
||
context "with good CAA records" do | ||
let(:caa_domain) { "letsencrypt.org" } | ||
before(:each) { allow(subject.send(:caa)).to receive(:query) { [caa_packet] } } | ||
|
||
it { is_expected.to be_https_eligible } | ||
end | ||
end | ||
end | ||
|
||
context "CNAME record pointed to username" do | ||
let(:cname) { "foobar.github.io" } | ||
before(:each) { allow(subject).to receive(:dns) { [cname_packet] } } | ||
before(:each) { allow(subject.send(:caa)).to receive(:query) { [cname_packet] } } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is required so that we return the |
||
|
||
it { is_expected.to be_https_eligible } | ||
|
||
|
@@ -880,11 +959,52 @@ | |
|
||
it { is_expected.to be_https_eligible } | ||
end | ||
|
||
context "with unicode encoded domain" do | ||
let(:domain) { "dómain.example.com" } | ||
|
||
it { is_expected.to be_https_eligible } | ||
|
||
context "with bad CAA records" do | ||
let(:caa_domain) { "digicert.com" } | ||
before(:each) { allow(subject.send(:caa)).to receive(:query) { [caa_packet] } } | ||
|
||
it { is_expected.not_to be_https_eligible } | ||
end | ||
|
||
context "with good CAA records" do | ||
let(:caa_domain) { "letsencrypt.org" } | ||
before(:each) { allow(subject.send(:caa)).to receive(:query) { [caa_packet] } } | ||
|
||
it { is_expected.to be_https_eligible } | ||
end | ||
end | ||
|
||
context "with punycode encoded domain" do | ||
let(:domain) { "xn--dmain-0ta.example.com" } | ||
|
||
it { is_expected.to be_https_eligible } | ||
|
||
context "with bad CAA records" do | ||
let(:caa_domain) { "digicert.com" } | ||
before(:each) { allow(subject.send(:caa)).to receive(:query) { [caa_packet] } } | ||
|
||
it { is_expected.not_to be_https_eligible } | ||
end | ||
|
||
context "with good CAA records" do | ||
let(:caa_domain) { "letsencrypt.org" } | ||
before(:each) { allow(subject.send(:caa)).to receive(:query) { [caa_packet] } } | ||
|
||
it { is_expected.to be_https_eligible } | ||
end | ||
end | ||
end | ||
|
||
context "CNAME record pointed elsewhere" do | ||
let(:cname) { "jinglebells.com" } | ||
before(:each) { allow(subject).to receive(:dns) { [cname_packet] } } | ||
before(:each) { allow(subject.send(:caa)).to receive(:query) { [cname_packet] } } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is required so that we return the |
||
|
||
it { is_expected.not_to be_https_eligible } | ||
|
||
|
@@ -901,6 +1021,18 @@ | |
|
||
it { is_expected.not_to be_https_eligible } | ||
end | ||
|
||
context "with unicode encoded domain" do | ||
let(:domain) { "dómain.example.com" } | ||
|
||
it { is_expected.not_to be_https_eligible } | ||
end | ||
|
||
context "with punycode encoded domain" do | ||
let(:domain) { "xn--dmain-0ta.example.com" } | ||
|
||
it { is_expected.not_to be_https_eligible } | ||
end | ||
end | ||
end | ||
end |
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.
This is required so that we return the
A
when noCAA
exists, imitating the behaviour seen in the real world. This hasn't been a issue until now, as the existing checks use adomain
ofpages.github.com
, so we get back entries from the real world here. It is only now that I have started using fake names that this has become a problem.