github-pages-health-check 1.18.2 → 1.18.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bd7b9a6265476c7ffa7b965ed0c331df229ceef7446b119fa35188acc8c43155
4
- data.tar.gz: fb46e328d327c0ca84f6d69e1a183ea1989b226596d9bef705b489536f37bc30
3
+ metadata.gz: be8f2f5afcacf1c6155e28bc3b0019f0096f2b2ff1bd6c5c86c8e3fc0336a86f
4
+ data.tar.gz: c68fa1d0c592ec2357331bb30f9ff7435348777d6872c0915ae1fea6dbb03e9d
5
5
  SHA512:
6
- metadata.gz: 52ed7e445d7a983bc42076cc9c23eb51bc0b9966d9642638503d5b1d2f7e23e13881162f5138cdffbee2635acc63b76f5b7a47b2bf99a120fcee931f1cc36034
7
- data.tar.gz: cfb67f8e4f0ed0c75e68c62d7bdd214842bb006dd824e9a09f331ccc9e7053e4e7f2cd16f443f61db6c5d3f262278a55168cf601e70c207feddc5c4bbee14c2c
6
+ metadata.gz: 77b2fcb2d737a1c28a8469333934335509664b169ab9a2483a5ab287ecd9ec43ef9ffc797d4cc2b2afd68929c7bc7a92ed897e8c3c832ad45b857c990c59359b
7
+ data.tar.gz: 1a6c44c4d002607840493af318bd7c8b3b6cf9fb5c34ea7e1ad67e9a2aff6b05900254eb6876bdff7aaf1c71527c7a86ff541a166e5112c323b7bf9d6b9b549f
@@ -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,20 @@ 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
+ # rubocop:disable Metrics/AbcSize
249
+ def cname_to_domain_to_pages?
250
+ return false unless dns?
251
+
252
+ a_record_to_pages = dns.select { |d| d.type == Dnsruby::Types::A && d.name.to_s == host }.first
253
+
254
+ return false unless a_record_to_pages && cname? && !cname_to_pages_dot_github_dot_com? && @www_cname
255
+
256
+ CURRENT_IP_ADDRESSES.include?(a_record_to_pages.address.to_s.downcase)
257
+ end
258
+ # rubocop:enable Metrics/AbcSize
259
+
246
260
  # Is the given domain a CNAME to pages.github.(io|com)
247
261
  # instead of being CNAME'd to the user's subdomain?
248
262
  #
@@ -273,7 +287,7 @@ module GitHubPages
273
287
 
274
288
  # Is this domain owned by GitHub?
275
289
  def github_domain?
276
- !!host.downcase.end_with?("github.com")
290
+ host.downcase.eql?("github.com") || host.downcase.end_with?(".github.com")
277
291
  end
278
292
 
279
293
  # Is the host our Fastly CNAME?
@@ -304,6 +318,7 @@ module GitHubPages
304
318
  return true if cloudflare_ip?
305
319
  return false if pointed_to_github_pages_ip?
306
320
  return false if cname_to_github_user_domain?
321
+ return false if cname_to_domain_to_pages?
307
322
  return false if cname_to_pages_dot_github_dot_com?
308
323
  return false if cname_to_fastly? || fastly_ip?
309
324
 
@@ -399,9 +414,16 @@ module GitHubPages
399
414
  cnames = dns.take_while { |answer| answer.type == Dnsruby::Types::CNAME }
400
415
  return if cnames.empty?
401
416
 
417
+ www_cname(cnames.last)
402
418
  @cname ||= Domain.new(cnames.last.cname.to_s)
403
419
  end
404
420
 
421
+ # Check if we have a 'www.' CNAME that matches the domain
422
+ def www_cname(cname)
423
+ @www_cname ||= cname.name.to_s.start_with?("www.") &&
424
+ cname.name.to_s.end_with?(cname.domainname.to_s)
425
+ end
426
+
405
427
  def mx_records_present?
406
428
  return unless dns?
407
429
 
@@ -454,8 +476,7 @@ module GitHubPages
454
476
  return false if host.include?("_")
455
477
 
456
478
  # 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?
479
+ return true if cname_to_github_user_domain? || cname_to_domain_to_pages?
459
480
 
460
481
  # Check CAA records for the full domain and its parent domain.
461
482
  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.5"
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.5
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: []