github-pages-health-check 1.18.1 → 1.18.4

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: 4c192823fd967f8d554b5eaa42b7e3eeac0a59a0456859f0617e1e5c44b9073c
4
- data.tar.gz: 69f956e87a2bc17ea4a64ef3aa01f29215bd0fe8c9cccacd32275a16bd6be4bd
3
+ metadata.gz: 9e2a387d18201b5732790cea5c70f84c736eb04433cb66cf8715b7afd263bbb7
4
+ data.tar.gz: c9ccd398d02d8d6a2f4b372bf022cb75688178951cca0fc0f0616cf7078c4fc0
5
5
  SHA512:
6
- metadata.gz: '0489d4d0a0d3df987f2cd47d414afca1933ccc2391b9d323ce17c8d8f3d0fe140244cca097689e913b5d6f5e7d7e7462628fed3c2f3d4eb2419340c87f0f3c76'
7
- data.tar.gz: cb3f76bc01a5e55bdbab02072f749480787af86ee37e609c218fb38552835f2ce4e8292c0fb6b54e0eed4196969d0fdbe64f2c861aa005bb01df3870256cf110
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
@@ -1,15 +1,20 @@
1
1
  version: 2
2
2
  updates:
3
- - package-ecosystem: bundler
4
- directory: "/"
5
- schedule:
6
- interval: daily
7
- time: "10:00"
8
- timezone: Europe/Vienna
9
- pull-request-branch-name:
10
- separator: "-"
11
- open-pull-requests-limit: 99
12
- allow:
13
- - dependency-type: direct
14
- - dependency-type: indirect
15
- rebase-strategy: disabled
3
+ - package-ecosystem: bundler
4
+ directory: "/"
5
+ schedule:
6
+ interval: daily
7
+ time: "10:00"
8
+ timezone: Europe/Vienna
9
+ pull-request-branch-name:
10
+ separator: "-"
11
+ open-pull-requests-limit: 99
12
+ allow:
13
+ - dependency-type: direct
14
+ - dependency-type: indirect
15
+ rebase-strategy: disabled
16
+
17
+ - package-ecosystem: "github-actions"
18
+ directory: "/"
19
+ schedule:
20
+ interval: weekly
@@ -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,16 +1,18 @@
1
1
  on: push
2
- name: cibuild on push
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"
6
8
  runs-on: ubuntu-latest
7
9
  strategy:
10
+ fail-fast: false
8
11
  matrix:
9
12
  ruby:
10
- - 2.5
11
- - 2.6
12
- - 2.7
13
- - 3.0
13
+ - '3.0'
14
+ - '3.1'
15
+ - '3.2'
14
16
  steps:
15
17
  - uses: actions/checkout@master
16
18
  - name: script/cibuild-docker
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
- 3.1.2
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
data/README.md CHANGED
@@ -2,7 +2,8 @@
2
2
 
3
3
  *Checks your GitHub Pages site for common DNS configuration issues*
4
4
 
5
- [![Build Status](https://travis-ci.org/github/pages-health-check.svg)](https://travis-ci.org/github/pages-health-check) [![Gem Version](https://badge.fury.io/rb/github-pages-health-check.svg)](http://badge.fury.io/rb/github-pages-health-check)
5
+ [![Build Status](https://github.com/github/pages-health-check/actions/workflows/push-cibuild.yml/badge.svg)](https://github.com/github/pages-health-check/actions/workflows/push-cibuild.yml)
6
+ [![Gem Version](https://badge.fury.io/rb/github-pages-health-check.svg)](http://badge.fury.io/rb/github-pages-health-check)
6
7
 
7
8
  ## Installation
8
9
 
@@ -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.0")
22
- s.add_dependency("public_suffix", ">= 3.0", "< 5.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?
@@ -160,7 +160,7 @@ module GitHubPages
160
160
  end
161
161
 
162
162
  # Is this a valid domain that PublicSuffix recognizes?
163
- # Used as an escape hatch to prevent false positives on DNS checkes
163
+ # Used as an escape hatch to prevent false positives on DNS checks
164
164
  def valid_domain?
165
165
  return @valid if defined? @valid
166
166
 
@@ -170,7 +170,7 @@ module GitHubPages
170
170
  :ignore_private => true)
171
171
  end
172
172
 
173
- # Is this domain an apex domain, meaning a CNAME would be innapropriate
173
+ # Is this domain an apex domain, meaning a CNAME would be inappropriate
174
174
  def apex_domain?
175
175
  return @apex_domain if defined?(@apex_domain)
176
176
 
@@ -202,7 +202,7 @@ module GitHubPages
202
202
  end
203
203
 
204
204
  #
205
- # Does the domain have assoicated NS records?
205
+ # Does the domain have associated NS records?
206
206
  #
207
207
  def dns_zone_ns?
208
208
  return @ns_records if defined?(@ns_records)
@@ -243,10 +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
+ 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
  #
249
- # domain - the domain to check, generaly the target of a cname
259
+ # domain - the domain to check, generally the target of a cname
250
260
  def cname_to_pages_dot_github_dot_com?
251
261
  cname? && cname.pages_dot_github_dot_com?
252
262
  end
@@ -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.1"
5
+ VERSION = "1.18.4"
6
6
  end
7
7
  end
@@ -41,7 +41,7 @@ module GitHubPages
41
41
  URL = "https://github.com/github/pages-health-check"
42
42
  USER_AGENT = "Mozilla/5.0 (compatible; #{HUMAN_NAME}/#{VERSION}; +#{URL})"
43
43
 
44
- # surpress warn-level feedback due to unsupported record types
44
+ # suppress warn-level feedback due to unsupported record types
45
45
  def self.without_warnings(&block)
46
46
  warn_level = $VERBOSE
47
47
  $VERBOSE = nil
@@ -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.1
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: 2022-10-11 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
@@ -42,16 +42,22 @@ dependencies:
42
42
  name: octokit
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '4'
48
+ - - "<"
46
49
  - !ruby/object:Gem::Version
47
- version: '4.0'
50
+ version: '10'
48
51
  type: :runtime
49
52
  prerelease: false
50
53
  version_requirements: !ruby/object:Gem::Requirement
51
54
  requirements:
52
- - - "~>"
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: '4'
58
+ - - "<"
53
59
  - !ruby/object:Gem::Version
54
- version: '4.0'
60
+ version: '10'
55
61
  - !ruby/object:Gem::Dependency
56
62
  name: public_suffix
57
63
  requirement: !ruby/object:Gem::Requirement
@@ -61,7 +67,7 @@ dependencies:
61
67
  version: '3.0'
62
68
  - - "<"
63
69
  - !ruby/object:Gem::Version
64
- version: '5.0'
70
+ version: '7.0'
65
71
  type: :runtime
66
72
  prerelease: false
67
73
  version_requirements: !ruby/object:Gem::Requirement
@@ -71,7 +77,7 @@ dependencies:
71
77
  version: '3.0'
72
78
  - - "<"
73
79
  - !ruby/object:Gem::Version
74
- version: '5.0'
80
+ version: '7.0'
75
81
  - !ruby/object:Gem::Dependency
76
82
  name: typhoeus
77
83
  requirement: !ruby/object:Gem::Requirement
@@ -93,7 +99,9 @@ extensions: []
93
99
  extra_rdoc_files: []
94
100
  files:
95
101
  - ".dockerignore"
102
+ - ".github/CODEOWNERS"
96
103
  - ".github/dependabot.yml"
104
+ - ".github/workflows/pages-gem.yml"
97
105
  - ".github/workflows/push-cibuild.yml"
98
106
  - ".gitignore"
99
107
  - ".rspec"
@@ -145,7 +153,7 @@ homepage: https://github.com/github/github-pages-health-check
145
153
  licenses:
146
154
  - MIT
147
155
  metadata: {}
148
- post_install_message:
156
+ post_install_message:
149
157
  rdoc_options: []
150
158
  require_paths:
151
159
  - lib
@@ -160,8 +168,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
160
168
  - !ruby/object:Gem::Version
161
169
  version: '0'
162
170
  requirements: []
163
- rubygems_version: 3.3.7
164
- signing_key:
171
+ rubygems_version: 3.4.19
172
+ signing_key:
165
173
  specification_version: 4
166
174
  summary: Checks your GitHub Pages site for commons DNS configuration issues
167
175
  test_files: []