Commit 472c7cb4 authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Merge branch 'pages-verify-domain-indicate-absolute' into 'master'

VerifyPagesDomain: suffix with . indicate absolute fqdn

See merge request gitlab-org/gitlab!75696
parents 81fb51d7 29d445eb
...@@ -85,7 +85,8 @@ class VerifyPagesDomainService < BaseService ...@@ -85,7 +85,8 @@ class VerifyPagesDomainService < BaseService
end end
def check(domain_name, resolver) def check(domain_name, resolver)
records = parse(txt_records(domain_name, resolver)) # Append '.' to domain_name, indicating absolute FQDN
records = parse(txt_records(domain_name + '.', resolver))
records.any? do |record| records.any? do |record|
record == domain.keyed_verification_code || record == domain.verification_code record == domain.keyed_verification_code || record == domain.verification_code
......
...@@ -372,7 +372,8 @@ RSpec.describe VerifyPagesDomainService do ...@@ -372,7 +372,8 @@ RSpec.describe VerifyPagesDomainService do
allow(resolver).to receive(:getresources) { [] } allow(resolver).to receive(:getresources) { [] }
stubbed_lookups.each do |domain, records| stubbed_lookups.each do |domain, records|
records = Array(records).map { |txt| Resolv::DNS::Resource::IN::TXT.new(txt) } records = Array(records).map { |txt| Resolv::DNS::Resource::IN::TXT.new(txt) }
allow(resolver).to receive(:getresources).with(domain, Resolv::DNS::Resource::IN::TXT) { records } # Append '.' to domain_name, indicating absolute FQDN
allow(resolver).to receive(:getresources).with(domain + '.', Resolv::DNS::Resource::IN::TXT) { records }
end end
resolver resolver
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment