github-pages-health-check 1.18.2 → 1.18.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bd7b9a6265476c7ffa7b965ed0c331df229ceef7446b119fa35188acc8c43155
4
- data.tar.gz: fb46e328d327c0ca84f6d69e1a183ea1989b226596d9bef705b489536f37bc30
3
+ metadata.gz: 9e2a387d18201b5732790cea5c70f84c736eb04433cb66cf8715b7afd263bbb7
4
+ data.tar.gz: c9ccd398d02d8d6a2f4b372bf022cb75688178951cca0fc0f0616cf7078c4fc0
5
5
  SHA512:
6
- metadata.gz: 52ed7e445d7a983bc42076cc9c23eb51bc0b9966d9642638503d5b1d2f7e23e13881162f5138cdffbee2635acc63b76f5b7a47b2bf99a120fcee931f1cc36034
7
- data.tar.gz: cfb67f8e4f0ed0c75e68c62d7bdd214842bb006dd824e9a09f331ccc9e7053e4e7f2cd16f443f61db6c5d3f262278a55168cf601e70c207feddc5c4bbee14c2c
6
+ metadata.gz: 20d385527764b7326b390244b38e44b2aa426748244d51e64feef83200111053efc3fe52a9cf55e0f523df27ddeaf2a24e1df15ae702a1948e2fcede15ba254d
7
+ data.tar.gz: 55bee6916048119777f9321cfe29a496317d855e6e428b185244c97b6ee1d77b23d16ca63be53e145a3467a94cf62858bace2c48ed0aade07c38d90000c1c274
@@ -0,0 +1,2 @@
1
+ # Automatically add our team to each pull request in this repo
2
+ * @github/pages-reviewers
@@ -0,0 +1,27 @@
1
+ name: Publish Gem
2
+
3
+ on:
4
+ release:
5
+ types: [released]
6
+
7
+ permissions:
8
+ contents: read
9
+
10
+ jobs:
11
+ release:
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - name: Checkout
15
+ uses: actions/checkout@v4
16
+ - name: Setup Ruby
17
+ uses: ruby/setup-ruby@52753b7da854d5c07df37391a986c76ab4615999 # v1.191.0
18
+ with:
19
+ ruby-version: '3.2'
20
+ - name: Build gem
21
+ run: |
22
+ gem build github-pages-health-check.gemspec
23
+ - name: Publish gem
24
+ env:
25
+ GEM_HOST_API_KEY: ${{ secrets.PAGES_GEM_PUBLISHING }}
26
+ run: |
27
+ gem push github-pages-health-check-*.gem
@@ -1,5 +1,7 @@
1
1
  on: push
2
2
  name: "GitHub Pages Health Check Tests"
3
+ permissions:
4
+ contents: read
3
5
  jobs:
4
6
  build:
5
7
  name: "GitHub Pages Health Check Tests"
@@ -8,8 +10,6 @@ jobs:
8
10
  fail-fast: false
9
11
  matrix:
10
12
  ruby:
11
- - '2.6'
12
- - '2.7'
13
13
  - '3.0'
14
14
  - '3.1'
15
15
  - '3.2'
data/.rubocop.yml CHANGED
@@ -17,7 +17,7 @@
17
17
  #
18
18
 
19
19
  AllCops:
20
- TargetRubyVersion: 2.6
20
+ TargetRubyVersion: 3.0
21
21
  Exclude:
22
22
  - 'bin/**/*'
23
23
  - 'script/**/*'
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.7.1
1
+ 3.2
data/Gemfile CHANGED
@@ -8,6 +8,7 @@ group :development do
8
8
  gem "pry", "~> 0.10"
9
9
  gem "pry-byebug"
10
10
  gem "rspec", "~> 3.0"
11
+ gem "rspec-retry", "~> 0.6"
11
12
  gem "rubocop", "~> 0.52"
12
13
  gem "webmock", "~> 3.8"
13
14
  end
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
18
18
 
19
19
  s.add_dependency("addressable", "~> 2.3")
20
20
  s.add_dependency("dnsruby", "~> 1.60")
21
- s.add_dependency("octokit", ">= 4", "< 8")
22
- s.add_dependency("public_suffix", ">= 3.0", "< 6.0")
21
+ s.add_dependency("octokit", ">= 4", "< 10")
22
+ s.add_dependency("public_suffix", ">= 3.0", "< 7.0")
23
23
  s.add_dependency("typhoeus", "~> 1.3")
24
24
  end
@@ -91,7 +91,7 @@ module GitHubPages
91
91
  host uri nameservers dns_resolves? proxied? cloudflare_ip?
92
92
  fastly_ip? old_ip_address? a_record? aaaa_record? a_record_present? aaaa_record_present?
93
93
  cname_record? mx_records_present? valid_domain? apex_domain?
94
- should_be_a_record? cname_to_github_user_domain?
94
+ should_be_a_record? cname_to_github_user_domain? cname_to_domain_to_pages?
95
95
  cname_to_pages_dot_github_dot_com? cname_to_fastly?
96
96
  pointed_to_github_pages_ip? non_github_pages_ip_present? pages_domain?
97
97
  served_by_pages? valid? reason valid_domain? https?
@@ -243,6 +243,16 @@ module GitHubPages
243
243
  cname? && !cname_to_pages_dot_github_dot_com? && cname.pages_domain?
244
244
  end
245
245
 
246
+ # Check if the CNAME points to a Domain that points to pages
247
+ # e.g. CNAME -> Domain -> Pages
248
+ def cname_to_domain_to_pages?
249
+ a_record_to_pages = dns.select { |d| d.type == Dnsruby::Types::A && d.name.to_s == host }.first
250
+
251
+ return false unless a_record_to_pages && cname? && !cname_to_pages_dot_github_dot_com? && @www_cname
252
+
253
+ CURRENT_IP_ADDRESSES.include?(a_record_to_pages.address.to_s.downcase)
254
+ end
255
+
246
256
  # Is the given domain a CNAME to pages.github.(io|com)
247
257
  # instead of being CNAME'd to the user's subdomain?
248
258
  #
@@ -273,7 +283,7 @@ module GitHubPages
273
283
 
274
284
  # Is this domain owned by GitHub?
275
285
  def github_domain?
276
- !!host.downcase.end_with?("github.com")
286
+ host.downcase.eql?("github.com") || host.downcase.end_with?(".github.com")
277
287
  end
278
288
 
279
289
  # Is the host our Fastly CNAME?
@@ -304,6 +314,7 @@ module GitHubPages
304
314
  return true if cloudflare_ip?
305
315
  return false if pointed_to_github_pages_ip?
306
316
  return false if cname_to_github_user_domain?
317
+ return false if cname_to_domain_to_pages?
307
318
  return false if cname_to_pages_dot_github_dot_com?
308
319
  return false if cname_to_fastly? || fastly_ip?
309
320
 
@@ -399,9 +410,16 @@ module GitHubPages
399
410
  cnames = dns.take_while { |answer| answer.type == Dnsruby::Types::CNAME }
400
411
  return if cnames.empty?
401
412
 
413
+ www_cname(cnames.last)
402
414
  @cname ||= Domain.new(cnames.last.cname.to_s)
403
415
  end
404
416
 
417
+ # Check if we have a 'www.' CNAME that matches the domain
418
+ def www_cname(cname)
419
+ @www_cname ||= cname.name.to_s.start_with?("www.") &&
420
+ cname.name.to_s.end_with?(cname.domainname.to_s)
421
+ end
422
+
405
423
  def mx_records_present?
406
424
  return unless dns?
407
425
 
@@ -454,8 +472,7 @@ module GitHubPages
454
472
  return false if host.include?("_")
455
473
 
456
474
  # Must be a CNAME or point to our IPs.
457
- # Only check the one domain if a CNAME. Don't check the parent domain.
458
- return true if cname_to_github_user_domain?
475
+ return true if cname_to_github_user_domain? || cname_to_domain_to_pages?
459
476
 
460
477
  # Check CAA records for the full domain and its parent domain.
461
478
  pointed_to_github_pages_ip? && caa.lets_encrypt_allowed?
@@ -2,6 +2,6 @@
2
2
 
3
3
  module GitHubPages
4
4
  module HealthCheck
5
- VERSION = "1.18.2"
5
+ VERSION = "1.18.4"
6
6
  end
7
7
  end
@@ -66,6 +66,7 @@ module GitHubPages
66
66
 
67
67
  @typhoeus_options = {
68
68
  :followlocation => true,
69
+ :redir_protocols => %i[http https], # don't allow non-http protocols on redirections
69
70
  :timeout => TIMEOUT,
70
71
  :accept_encoding => "gzip",
71
72
  :method => :head,
@@ -1,6 +1,6 @@
1
1
  #!/bin/bash
2
2
 
3
- : ${RUBY_VERSION:="2.7"}
3
+ : ${RUBY_VERSION:="3.2"}
4
4
  docker build -t github-pages-health-check --build-arg RUBY_VERSION=$RUBY_VERSION .
5
5
  if [ -n "$DEBUG" ]; then
6
6
  # Run a shell.
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.18.2
4
+ version: 1.18.4
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: 2023-10-19 00:00:00.000000000 Z
11
+ date: 2024-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -47,7 +47,7 @@ dependencies:
47
47
  version: '4'
48
48
  - - "<"
49
49
  - !ruby/object:Gem::Version
50
- version: '8'
50
+ version: '10'
51
51
  type: :runtime
52
52
  prerelease: false
53
53
  version_requirements: !ruby/object:Gem::Requirement
@@ -57,7 +57,7 @@ dependencies:
57
57
  version: '4'
58
58
  - - "<"
59
59
  - !ruby/object:Gem::Version
60
- version: '8'
60
+ version: '10'
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: public_suffix
63
63
  requirement: !ruby/object:Gem::Requirement
@@ -67,7 +67,7 @@ dependencies:
67
67
  version: '3.0'
68
68
  - - "<"
69
69
  - !ruby/object:Gem::Version
70
- version: '6.0'
70
+ version: '7.0'
71
71
  type: :runtime
72
72
  prerelease: false
73
73
  version_requirements: !ruby/object:Gem::Requirement
@@ -77,7 +77,7 @@ dependencies:
77
77
  version: '3.0'
78
78
  - - "<"
79
79
  - !ruby/object:Gem::Version
80
- version: '6.0'
80
+ version: '7.0'
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: typhoeus
83
83
  requirement: !ruby/object:Gem::Requirement
@@ -99,7 +99,9 @@ extensions: []
99
99
  extra_rdoc_files: []
100
100
  files:
101
101
  - ".dockerignore"
102
+ - ".github/CODEOWNERS"
102
103
  - ".github/dependabot.yml"
104
+ - ".github/workflows/pages-gem.yml"
103
105
  - ".github/workflows/push-cibuild.yml"
104
106
  - ".gitignore"
105
107
  - ".rspec"
@@ -151,7 +153,7 @@ homepage: https://github.com/github/github-pages-health-check
151
153
  licenses:
152
154
  - MIT
153
155
  metadata: {}
154
- post_install_message:
156
+ post_install_message:
155
157
  rdoc_options: []
156
158
  require_paths:
157
159
  - lib
@@ -166,8 +168,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
166
168
  - !ruby/object:Gem::Version
167
169
  version: '0'
168
170
  requirements: []
169
- rubygems_version: 3.3.26
170
- signing_key:
171
+ rubygems_version: 3.4.19
172
+ signing_key:
171
173
  specification_version: 4
172
174
  summary: Checks your GitHub Pages site for commons DNS configuration issues
173
175
  test_files: []