github-pages-health-check 1.18.4 → 1.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/pages-gem.yml +2 -2
- data/.github/workflows/push-cibuild.yml +1 -1
- data/.ruby-version +1 -1
- data/github-pages-health-check.gemspec +1 -1
- data/lib/github-pages-health-check/domain.rb +40 -0
- data/lib/github-pages-health-check/errors/wildcard_record_error.rb +26 -0
- data/lib/github-pages-health-check/resolver.rb +3 -3
- data/lib/github-pages-health-check/version.rb +1 -1
- metadata +9 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f2a1a3411ae633f468b19e0ac83279b0d4670b90345250f9c15924d69b31b794
|
4
|
+
data.tar.gz: 59c1251b90c8e5c76a1db5025a481a988a697d380f9a339dd2e34d963b4c7f32
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 445d74066cf216a0ca6aa1fc32afc5dae3aa421c7735c1ec017234b819968900b9cb4ee1def153c8f26a1ef2fbdce86d42f4aa4b0abb098c4f4d100e9e5dcce5
|
7
|
+
data.tar.gz: bf5038c6d651bb2683c0d72ced5eecc4d23a45da69c05e1bc0e2b0ec04255bd7e3d7e412eae425906677df80fede859639a4b2c95a5e277faf14af6b33635aca
|
@@ -14,9 +14,9 @@ jobs:
|
|
14
14
|
- name: Checkout
|
15
15
|
uses: actions/checkout@v4
|
16
16
|
- name: Setup Ruby
|
17
|
-
uses: ruby/setup-ruby@
|
17
|
+
uses: ruby/setup-ruby@13e7a03dc3ac6c3798f4570bfead2aed4d96abfb # v1.244.0
|
18
18
|
with:
|
19
|
-
ruby-version: '3.
|
19
|
+
ruby-version: '3.3'
|
20
20
|
- name: Build gem
|
21
21
|
run: |
|
22
22
|
gem build github-pages-health-check.gemspec
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.
|
1
|
+
3.3
|
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
17
|
s.require_paths = ["lib"]
|
18
18
|
|
19
|
-
s.add_dependency("addressable", "~> 2.
|
19
|
+
s.add_dependency("addressable", "~> 2.8.7")
|
20
20
|
s.add_dependency("dnsruby", "~> 1.60")
|
21
21
|
s.add_dependency("octokit", ">= 4", "< 10")
|
22
22
|
s.add_dependency("public_suffix", ">= 3.0", "< 7.0")
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "securerandom"
|
4
|
+
|
3
5
|
module GitHubPages
|
4
6
|
module HealthCheck
|
5
7
|
class Domain < Checkable
|
@@ -245,13 +247,17 @@ module GitHubPages
|
|
245
247
|
|
246
248
|
# Check if the CNAME points to a Domain that points to pages
|
247
249
|
# e.g. CNAME -> Domain -> Pages
|
250
|
+
# rubocop:disable Metrics/AbcSize
|
248
251
|
def cname_to_domain_to_pages?
|
252
|
+
return false unless dns?
|
253
|
+
|
249
254
|
a_record_to_pages = dns.select { |d| d.type == Dnsruby::Types::A && d.name.to_s == host }.first
|
250
255
|
|
251
256
|
return false unless a_record_to_pages && cname? && !cname_to_pages_dot_github_dot_com? && @www_cname
|
252
257
|
|
253
258
|
CURRENT_IP_ADDRESSES.include?(a_record_to_pages.address.to_s.downcase)
|
254
259
|
end
|
260
|
+
# rubocop:enable Metrics/AbcSize
|
255
261
|
|
256
262
|
# Is the given domain a CNAME to pages.github.(io|com)
|
257
263
|
# instead of being CNAME'd to the user's subdomain?
|
@@ -438,6 +444,40 @@ module GitHubPages
|
|
438
444
|
end
|
439
445
|
end
|
440
446
|
|
447
|
+
def parent_domain
|
448
|
+
parsed = PublicSuffix.parse(host)
|
449
|
+
parent = host.split(".", 2).last
|
450
|
+
if parent == parsed.tld
|
451
|
+
return nil
|
452
|
+
end
|
453
|
+
|
454
|
+
parent
|
455
|
+
rescue PublicSuffix::DomainNotAllowed
|
456
|
+
nil
|
457
|
+
end
|
458
|
+
|
459
|
+
def maybe_wildcard?
|
460
|
+
return @maybe_wildcard if defined? @maybe_wildcard
|
461
|
+
return false unless dns_resolves?
|
462
|
+
return false unless parent_domain
|
463
|
+
|
464
|
+
sibling_domain = SecureRandom.alphanumeric(20) + "." + parent_domain
|
465
|
+
|
466
|
+
@maybe_wildcard = begin
|
467
|
+
wildcard_resolver = GitHubPages::HealthCheck::Resolver.new(sibling_domain, :nameservers => nameservers)
|
468
|
+
|
469
|
+
[Dnsruby::Types::A, Dnsruby::Types::AAAA].any? do |record_type|
|
470
|
+
wildcard_resolver.query(record_type).any? do |record|
|
471
|
+
record.respond_to?(:address) && github_pages_ip?(record.address)
|
472
|
+
end
|
473
|
+
end
|
474
|
+
end
|
475
|
+
end
|
476
|
+
|
477
|
+
def wildcard_warning
|
478
|
+
Errors::WildcardRecordError.new :domain => self, :parent_domain => parent_domain if maybe_wildcard?
|
479
|
+
end
|
480
|
+
|
441
481
|
def uri(overrides = {})
|
442
482
|
options = { :host => host, :scheme => scheme, :path => "/" }
|
443
483
|
options = options.merge(overrides)
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module GitHubPages
|
4
|
+
module HealthCheck
|
5
|
+
module Errors
|
6
|
+
class WildcardRecordError < GitHubPages::HealthCheck::Error
|
7
|
+
DOCUMENTATION_PATH = "/pages/configuring-a-custom-domain-for-your-github-pages-site/verifying-your-custom-domain-for-github-pages/"
|
8
|
+
|
9
|
+
attr_reader :parent_domain
|
10
|
+
|
11
|
+
def initialize(repository: nil, domain: nil, parent_domain: nil)
|
12
|
+
super(:repository => repository, :domain => domain)
|
13
|
+
@parent_domain = parent_domain
|
14
|
+
end
|
15
|
+
|
16
|
+
def message
|
17
|
+
<<-MSG
|
18
|
+
The DNS record for your domain appears to be *.#{parent_domain}, a wildcard record.
|
19
|
+
Your GitHub Pages site will still work, but unless you verify ownership of #{parent_domain},
|
20
|
+
any GitHub Pages user can serve their content from an arbitrary subdomain of it.
|
21
|
+
MSG
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -43,15 +43,15 @@ module GitHubPages
|
|
43
43
|
self.class.default_resolver
|
44
44
|
when :authoritative
|
45
45
|
Dnsruby::Resolver.new(DEFAULT_RESOLVER_OPTIONS.merge(
|
46
|
-
:
|
46
|
+
:nameserver => authoritative_nameservers
|
47
47
|
))
|
48
48
|
when :public
|
49
49
|
Dnsruby::Resolver.new(DEFAULT_RESOLVER_OPTIONS.merge(
|
50
|
-
:
|
50
|
+
:nameserver => PUBLIC_NAMESERVERS
|
51
51
|
))
|
52
52
|
when Array
|
53
53
|
Dnsruby::Resolver.new(DEFAULT_RESOLVER_OPTIONS.merge(
|
54
|
-
:
|
54
|
+
:nameserver => nameservers
|
55
55
|
))
|
56
56
|
else
|
57
57
|
raise "Invalid nameserver type: #{nameservers.inspect}"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: github-pages-health-check
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.19.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitHub, Inc.
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-06-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 2.8.7
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 2.8.7
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: dnsruby
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -133,6 +133,7 @@ files:
|
|
133
133
|
- lib/github-pages-health-check/errors/invalid_repository_error.rb
|
134
134
|
- lib/github-pages-health-check/errors/missing_access_token_error.rb
|
135
135
|
- lib/github-pages-health-check/errors/not_served_by_pages_error.rb
|
136
|
+
- lib/github-pages-health-check/errors/wildcard_record_error.rb
|
136
137
|
- lib/github-pages-health-check/printer.rb
|
137
138
|
- lib/github-pages-health-check/redundant_check.rb
|
138
139
|
- lib/github-pages-health-check/repository.rb
|
@@ -153,7 +154,7 @@ homepage: https://github.com/github/github-pages-health-check
|
|
153
154
|
licenses:
|
154
155
|
- MIT
|
155
156
|
metadata: {}
|
156
|
-
post_install_message:
|
157
|
+
post_install_message:
|
157
158
|
rdoc_options: []
|
158
159
|
require_paths:
|
159
160
|
- lib
|
@@ -168,8 +169,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
168
169
|
- !ruby/object:Gem::Version
|
169
170
|
version: '0'
|
170
171
|
requirements: []
|
171
|
-
rubygems_version: 3.
|
172
|
-
signing_key:
|
172
|
+
rubygems_version: 3.5.22
|
173
|
+
signing_key:
|
173
174
|
specification_version: 4
|
174
175
|
summary: Checks your GitHub Pages site for commons DNS configuration issues
|
175
176
|
test_files: []
|