site-inspector 3.2.0 → 4.0.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.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +30 -0
  3. data/.rubocop.yml +1 -5
  4. data/.rubocop_todo.yml +185 -79
  5. data/.ruby-version +1 -1
  6. data/CHANGELOG.md +71 -0
  7. data/Gemfile +0 -2
  8. data/README.md +8 -14
  9. data/bin/site-inspector +13 -13
  10. data/lib/cliver/dependency_ext.rb +2 -2
  11. data/lib/data/well-known.yml +51 -0
  12. data/lib/site-inspector/domain.rb +27 -15
  13. data/lib/site-inspector/domain_parser.rb +11 -0
  14. data/lib/site-inspector/{checks → endpoint}/accessibility.rb +6 -4
  15. data/lib/site-inspector/{checks → endpoint}/check.rb +5 -1
  16. data/lib/site-inspector/endpoint/content.rb +151 -0
  17. data/lib/site-inspector/{checks → endpoint}/cookies.rb +13 -5
  18. data/lib/site-inspector/{checks → endpoint}/dns.rb +42 -18
  19. data/lib/site-inspector/endpoint/headers.rb +55 -0
  20. data/lib/site-inspector/{checks → endpoint}/hsts.rb +36 -5
  21. data/lib/site-inspector/endpoint/wappalyzer.rb +68 -0
  22. data/lib/site-inspector/endpoint/well_known.rb +95 -0
  23. data/lib/site-inspector/endpoint/whois.rb +56 -0
  24. data/lib/site-inspector/endpoint.rb +60 -23
  25. data/lib/site-inspector/formatter.rb +118 -0
  26. data/lib/site-inspector/version.rb +1 -1
  27. data/lib/site-inspector.rb +34 -30
  28. data/package-lock.json +670 -23
  29. data/package.json +2 -1
  30. data/renovate.json +4 -0
  31. data/script/benchmark +8 -0
  32. data/script/cibuild +2 -2
  33. data/script/console +1 -1
  34. data/script/pa11y-version +1 -1
  35. data/script/release +11 -4
  36. data/script/update-well-known +18 -0
  37. data/site-inspector.gemspec +16 -9
  38. data/spec/cliver/dependency_ext_spec.rb +21 -0
  39. data/spec/{site_inspector_domain_spec.rb → site_inspector/domain_spec.rb} +71 -9
  40. data/spec/{checks/site_inspector_endpoint_accessibility_spec.rb → site_inspector/endpoint/accessibility_spec.rb} +9 -7
  41. data/spec/{checks/site_inspector_endpoint_content_spec.rb → site_inspector/endpoint/content_spec.rb} +14 -4
  42. data/spec/{checks/site_inspector_endpoint_cookies_spec.rb → site_inspector/endpoint/cookies_spec.rb} +27 -14
  43. data/spec/{checks/site_inspector_endpoint_dns_spec.rb → site_inspector/endpoint/dns_spec.rb} +87 -9
  44. data/spec/{checks/site_inspector_endpoint_headers_spec.rb → site_inspector/endpoint/headers_spec.rb} +0 -7
  45. data/spec/{checks/site_inspector_endpoint_hsts_spec.rb → site_inspector/endpoint/hsts_spec.rb} +8 -8
  46. data/spec/site_inspector/endpoint/wappalyzer_spec.rb +20 -0
  47. data/spec/site_inspector/endpoint/well_known_spec.rb +12 -0
  48. data/spec/{checks/site_inspector_endpoint_whois_spec.rb → site_inspector/endpoint/whois_spec.rb} +2 -1
  49. data/spec/{site_inspector_endpoint_spec.rb → site_inspector/endpoint_spec.rb} +59 -3
  50. data/spec/site_inspector_spec.rb +58 -11
  51. data/spec/spec_helper.rb +9 -2
  52. metadata +100 -92
  53. data/.travis.yml +0 -9
  54. data/lib/site-inspector/cache.rb +0 -17
  55. data/lib/site-inspector/checks/content.rb +0 -85
  56. data/lib/site-inspector/checks/headers.rb +0 -68
  57. data/lib/site-inspector/checks/sniffer.rb +0 -67
  58. data/lib/site-inspector/checks/wappalyzer.rb +0 -62
  59. data/lib/site-inspector/checks/whois.rb +0 -36
  60. data/lib/site-inspector/disk_cache.rb +0 -42
  61. data/lib/site-inspector/rails_cache.rb +0 -13
  62. data/spec/checks/site_inspector_endpoint_sniffer_spec.rb +0 -150
  63. data/spec/checks/site_inspector_endpoint_wappalyzer_spec.rb +0 -34
  64. data/spec/site_inspector_cache_spec.rb +0 -15
  65. data/spec/site_inspector_disk_cache_spec.rb +0 -39
  66. /data/lib/site-inspector/{checks → endpoint}/https.rb +0 -0
  67. /data/spec/{checks/site_inspector_endpoint_check_spec.rb → site_inspector/endpoint/check_spec.rb} +0 -0
  68. /data/spec/{checks/site_inspector_endpoint_https_spec.rb → site_inspector/endpoint/https_spec.rb} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9da6e03626519a29904ac4f663565104f6793e9fedae46f786f268ea7beaf870
4
- data.tar.gz: 100c9e6f24fd2f5ded3cc7239d37f30852eb7c7cd4a0c69651fc1d260c0043c6
3
+ metadata.gz: fcfea7cf5820cbc1cd0d845ce7a5e14bbbc5a62e76397b73fbc17c15657f2f57
4
+ data.tar.gz: 719dc99c75964e87815b198d8099580d304600f17b2f3ed27f247cef93ac741b
5
5
  SHA512:
6
- metadata.gz: 974095f3bc91b3a83c90ef9fa9879942e66e3a4927b0e1d83a0cba2727c9f7e301ab151a3f0bac1ff507d3a16549c64af4be23fdd245ede0ac0dc25401096ba2
7
- data.tar.gz: 16378f1054392ef3aa472469860367bab3c4d276bd57eaec9131382109aa85218ad535d82477d215d7c0294f310e82eac987275fd1b7d5148c5d3a1e722c8ab5
6
+ metadata.gz: b97dcdc47fe1f36846783ed03ca930ea381b359af5be5a08105af16fe11f1a4df025b1aeecf2f3b7533c956371e5e524a9245bd9ca9251a47288c065fbf7aa2f
7
+ data.tar.gz: 1043152c32b5f48f0e9190637e18ba8c3663fdf7b885d0f7d22dc11a8951f191deb3db415198a1c7bd6a72dd97c167948a6177f7b54f127b722321ade91b7884
@@ -0,0 +1,30 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [ main ]
6
+ pull_request:
7
+ branches: [ main ]
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ jobs:
13
+ test:
14
+
15
+ runs-on: ubuntu-latest
16
+
17
+ strategy:
18
+ fail-fast: false
19
+ matrix:
20
+ ruby-version: ['3.2', '3.3', '3.4']
21
+
22
+ steps:
23
+ - uses: actions/checkout@v4
24
+ - name: Set up Ruby
25
+ uses: ruby/setup-ruby@v1
26
+ with:
27
+ ruby-version: ${{ matrix.ruby-version }}
28
+ bundler-cache: true
29
+ - name: Run tests
30
+ run: script/cibuild
data/.rubocop.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  inherit_from: .rubocop_todo.yml
2
2
 
3
- require:
3
+ plugins:
4
4
  - rubocop-performance
5
5
  - rubocop-rspec
6
6
 
@@ -36,7 +36,3 @@ Style/ClassVars:
36
36
 
37
37
  Metrics/BlockLength:
38
38
  Enabled: false
39
-
40
- Security/MarshalLoad:
41
- Exclude:
42
- - lib/site-inspector/disk_cache.rb
data/.rubocop_todo.yml CHANGED
@@ -1,139 +1,245 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2020-11-13 02:59:59 UTC using RuboCop version 1.3.0.
3
+ # on 2026-09-05 04:33:00 UTC using RuboCop version 1.90.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
+ # Offense count: 7
10
+ # Configuration parameters: EnforcedStyle, AllowedGems.
11
+ # SupportedStyles: Gemfile, gems.rb, gemspec
12
+ Gemspec/DevelopmentDependencies:
13
+ Exclude:
14
+ - 'site-inspector.gemspec'
15
+
9
16
  # Offense count: 1
10
- # Configuration parameters: Include.
11
- # Include: **/*.gemspec
12
- Gemspec/RequiredRubyVersion:
17
+ # This cop supports safe autocorrection (--autocorrect).
18
+ # Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation.
19
+ Gemspec/OrderedDependencies:
13
20
  Exclude:
14
21
  - 'site-inspector.gemspec'
15
22
 
23
+ # Offense count: 1
24
+ # This cop supports safe autocorrection (--autocorrect).
25
+ # Configuration parameters: AllowedMethods, AllowedPatterns.
26
+ Lint/AmbiguousBlockAssociation:
27
+ Exclude:
28
+ - 'script/benchmark'
29
+
16
30
  # Offense count: 3
17
31
  # Configuration parameters: AllowComments, AllowEmptyLambdas.
18
32
  Lint/EmptyBlock:
19
33
  Exclude:
20
- - 'spec/site_inspector_domain_spec.rb'
34
+ - 'spec/site_inspector/domain_spec.rb'
21
35
 
22
- # Offense count: 1
36
+ # Offense count: 2
23
37
  Lint/NoReturnInBeginEndBlocks:
24
38
  Exclude:
25
39
  - 'lib/site-inspector/endpoint.rb'
40
+ - 'lib/site-inspector/endpoint/content.rb'
26
41
 
27
42
  # Offense count: 2
28
- # Configuration parameters: IgnoredMethods.
43
+ # Configuration parameters: AllowedMethods, AllowedPatterns.
29
44
  Metrics/PerceivedComplexity:
30
45
  Max: 9
31
46
 
32
- # Offense count: 3
47
+ # Offense count: 2
48
+ # This cop supports safe autocorrection (--autocorrect).
49
+ # Configuration parameters: EnforcedStyle, BlockForwardingName.
50
+ # SupportedStyles: anonymous, explicit
51
+ Naming/BlockForwarding:
52
+ Exclude:
53
+ - 'lib/site-inspector/formatter.rb'
54
+
55
+ # Offense count: 6
56
+ # This cop supports unsafe autocorrection (--autocorrect-all).
33
57
  # Configuration parameters: EnforcedStyleForLeadingUnderscores.
34
58
  # SupportedStylesForLeadingUnderscores: disallowed, required, optional
35
59
  Naming/MemoizedInstanceVariableName:
36
60
  Exclude:
37
- - 'lib/site-inspector/checks/accessibility.rb'
61
+ - 'lib/site-inspector/endpoint/accessibility.rb'
62
+ - 'lib/site-inspector/endpoint/wappalyzer.rb'
63
+
64
+ # Offense count: 1
65
+ # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
66
+ # AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to
67
+ Naming/MethodParameterName:
68
+ Exclude:
69
+ - 'lib/site-inspector/endpoint/well_known.rb'
70
+
71
+ # Offense count: 2
72
+ # Configuration parameters: Mode, AllowedMethods, AllowedPatterns, AllowBangMethods, WaywardPredicates.
73
+ # AllowedMethods: call
74
+ # WaywardPredicates: infinite?, nonzero?
75
+ Naming/PredicateMethod:
76
+ Exclude:
77
+ - 'lib/site-inspector/endpoint/content.rb'
78
+
79
+ # Offense count: 1
80
+ # This cop supports unsafe autocorrection (--autocorrect-all).
81
+ Performance/InefficientHashSearch:
82
+ Exclude:
83
+ - 'lib/site-inspector/endpoint/well_known.rb'
38
84
 
39
85
  # Offense count: 23
40
- # Configuration parameters: Prefixes.
86
+ # Configuration parameters: Prefixes, AllowedPatterns.
41
87
  # Prefixes: when, with, without
42
88
  RSpec/ContextWording:
43
89
  Exclude:
44
- - 'spec/checks/site_inspector_endpoint_content_spec.rb'
45
- - 'spec/checks/site_inspector_endpoint_dns_spec.rb'
46
- - 'spec/checks/site_inspector_endpoint_sniffer_spec.rb'
47
- - 'spec/site_inspector_domain_spec.rb'
48
- - 'spec/site_inspector_endpoint_spec.rb'
90
+ - 'spec/site_inspector/domain_spec.rb'
91
+ - 'spec/site_inspector/endpoint/content_spec.rb'
92
+ - 'spec/site_inspector/endpoint/dns_spec.rb'
93
+ - 'spec/site_inspector/endpoint_spec.rb'
49
94
 
50
- # Offense count: 1
95
+ # Offense count: 2
96
+ # This cop supports unsafe autocorrection (--autocorrect-all).
51
97
  RSpec/EmptyExampleGroup:
52
98
  Exclude:
53
- - 'spec/checks/site_inspector_endpoint_accessibility_spec.rb'
99
+ - 'spec/site_inspector/endpoint/wappalyzer_spec.rb'
100
+ - 'spec/site_inspector/endpoint/well_known_spec.rb'
54
101
 
55
- # Offense count: 24
56
- # Configuration parameters: Max.
102
+ # Offense count: 23
103
+ # Configuration parameters: CountAsOne.
57
104
  RSpec/ExampleLength:
105
+ Max: 20
106
+
107
+ # Offense count: 3
108
+ # This cop supports safe autocorrection (--autocorrect).
109
+ RSpec/MatchWithSimpleRegex:
58
110
  Exclude:
59
- - 'spec/checks/site_inspector_endpoint_dns_spec.rb'
60
- - 'spec/checks/site_inspector_endpoint_hsts_spec.rb'
61
- - 'spec/checks/site_inspector_endpoint_https_spec.rb'
62
- - 'spec/checks/site_inspector_endpoint_sniffer_spec.rb'
63
- - 'spec/checks/site_inspector_endpoint_wappalyzer_spec.rb'
64
- - 'spec/site_inspector_disk_cache_spec.rb'
65
- - 'spec/site_inspector_domain_spec.rb'
66
- - 'spec/site_inspector_endpoint_spec.rb'
67
- - 'spec/site_inspector_spec.rb'
68
-
69
- # Offense count: 15
70
- # Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly.
71
- # Include: **/*_spec*rb*, **/spec/**/*
72
- RSpec/FilePath:
73
- Exclude:
74
- - 'spec/checks/site_inspector_endpoint_accessibility_spec.rb'
75
- - 'spec/checks/site_inspector_endpoint_check_spec.rb'
76
- - 'spec/checks/site_inspector_endpoint_content_spec.rb'
77
- - 'spec/checks/site_inspector_endpoint_cookies_spec.rb'
78
- - 'spec/checks/site_inspector_endpoint_dns_spec.rb'
79
- - 'spec/checks/site_inspector_endpoint_headers_spec.rb'
80
- - 'spec/checks/site_inspector_endpoint_hsts_spec.rb'
81
- - 'spec/checks/site_inspector_endpoint_https_spec.rb'
82
- - 'spec/checks/site_inspector_endpoint_sniffer_spec.rb'
83
- - 'spec/checks/site_inspector_endpoint_wappalyzer_spec.rb'
84
- - 'spec/checks/site_inspector_endpoint_whois_spec.rb'
85
- - 'spec/site_inspector_cache_spec.rb'
86
- - 'spec/site_inspector_disk_cache_spec.rb'
87
- - 'spec/site_inspector_domain_spec.rb'
88
- - 'spec/site_inspector_endpoint_spec.rb'
89
-
90
- # Offense count: 55
111
+ - 'spec/site_inspector/endpoint/cookies_spec.rb'
112
+ - 'spec/site_inspector/endpoint/whois_spec.rb'
113
+
114
+ # Offense count: 54
91
115
  RSpec/MultipleExpectations:
92
116
  Max: 5
93
117
 
94
- # Offense count: 240
95
- # Configuration parameters: IgnoreSharedExamples.
118
+ # Offense count: 235
119
+ # Configuration parameters: EnforcedStyle, IgnoreSharedExamples.
120
+ # SupportedStyles: always, named_only
96
121
  RSpec/NamedSubject:
97
122
  Exclude:
98
- - 'spec/checks/site_inspector_endpoint_accessibility_spec.rb'
99
- - 'spec/checks/site_inspector_endpoint_check_spec.rb'
100
- - 'spec/checks/site_inspector_endpoint_content_spec.rb'
101
- - 'spec/checks/site_inspector_endpoint_cookies_spec.rb'
102
- - 'spec/checks/site_inspector_endpoint_dns_spec.rb'
103
- - 'spec/checks/site_inspector_endpoint_headers_spec.rb'
104
- - 'spec/checks/site_inspector_endpoint_hsts_spec.rb'
105
- - 'spec/checks/site_inspector_endpoint_https_spec.rb'
106
- - 'spec/checks/site_inspector_endpoint_sniffer_spec.rb'
107
- - 'spec/checks/site_inspector_endpoint_wappalyzer_spec.rb'
108
- - 'spec/checks/site_inspector_endpoint_whois_spec.rb'
109
- - 'spec/site_inspector_cache_spec.rb'
110
- - 'spec/site_inspector_disk_cache_spec.rb'
111
- - 'spec/site_inspector_domain_spec.rb'
112
- - 'spec/site_inspector_endpoint_spec.rb'
123
+ - 'spec/site_inspector/domain_spec.rb'
124
+ - 'spec/site_inspector/endpoint/accessibility_spec.rb'
125
+ - 'spec/site_inspector/endpoint/check_spec.rb'
126
+ - 'spec/site_inspector/endpoint/content_spec.rb'
127
+ - 'spec/site_inspector/endpoint/cookies_spec.rb'
128
+ - 'spec/site_inspector/endpoint/dns_spec.rb'
129
+ - 'spec/site_inspector/endpoint/headers_spec.rb'
130
+ - 'spec/site_inspector/endpoint/hsts_spec.rb'
131
+ - 'spec/site_inspector/endpoint/https_spec.rb'
132
+ - 'spec/site_inspector/endpoint/whois_spec.rb'
133
+ - 'spec/site_inspector/endpoint_spec.rb'
134
+
135
+ # Offense count: 6
136
+ # Configuration parameters: AllowedPatterns.
137
+ # AllowedPatterns: ^expect_, ^assert_
138
+ RSpec/NoExpectationExample:
139
+ Exclude:
140
+ - 'spec/site_inspector/domain_spec.rb'
141
+
142
+ # Offense count: 1
143
+ RSpec/PendingWithoutReason:
144
+ Exclude:
145
+ - 'spec/site_inspector/endpoint_spec.rb'
113
146
 
114
147
  # Offense count: 2
115
148
  RSpec/RepeatedDescription:
116
149
  Exclude:
117
- - 'spec/checks/site_inspector_endpoint_content_spec.rb'
150
+ - 'spec/site_inspector/endpoint/content_spec.rb'
118
151
 
119
152
  # Offense count: 9
120
153
  RSpec/RepeatedExample:
121
154
  Exclude:
122
- - 'spec/checks/site_inspector_endpoint_accessibility_spec.rb'
123
- - 'spec/checks/site_inspector_endpoint_content_spec.rb'
124
- - 'spec/site_inspector_domain_spec.rb'
155
+ - 'spec/site_inspector/domain_spec.rb'
156
+ - 'spec/site_inspector/endpoint/accessibility_spec.rb'
157
+ - 'spec/site_inspector/endpoint/content_spec.rb'
125
158
 
126
159
  # Offense count: 2
127
160
  RSpec/RepeatedExampleGroupDescription:
128
161
  Exclude:
129
- - 'spec/site_inspector_domain_spec.rb'
162
+ - 'spec/site_inspector/domain_spec.rb'
163
+
164
+ # Offense count: 2
165
+ # This cop supports safe autocorrection (--autocorrect).
166
+ RSpec/ScatteredSetup:
167
+ Exclude:
168
+ - 'spec/site_inspector/endpoint/accessibility_spec.rb'
130
169
 
131
170
  # Offense count: 30
132
171
  RSpec/SubjectStub:
133
172
  Exclude:
134
- - 'spec/checks/site_inspector_endpoint_accessibility_spec.rb'
135
- - 'spec/checks/site_inspector_endpoint_dns_spec.rb'
136
- - 'spec/checks/site_inspector_endpoint_headers_spec.rb'
137
- - 'spec/checks/site_inspector_endpoint_hsts_spec.rb'
138
- - 'spec/checks/site_inspector_endpoint_https_spec.rb'
139
- - 'spec/site_inspector_endpoint_spec.rb'
173
+ - 'spec/cliver/dependency_ext_spec.rb'
174
+ - 'spec/site_inspector/endpoint/accessibility_spec.rb'
175
+ - 'spec/site_inspector/endpoint/dns_spec.rb'
176
+ - 'spec/site_inspector/endpoint/headers_spec.rb'
177
+ - 'spec/site_inspector/endpoint/hsts_spec.rb'
178
+ - 'spec/site_inspector/endpoint/https_spec.rb'
179
+ - 'spec/site_inspector/endpoint_spec.rb'
180
+
181
+ # Offense count: 4
182
+ # This cop supports safe autocorrection (--autocorrect).
183
+ # Configuration parameters: AllowOnlyRestArgument, UseAnonymousForwarding, RedundantRestArgumentNames, RedundantKeywordRestArgumentNames, RedundantBlockArgumentNames.
184
+ # RedundantRestArgumentNames: args, arguments
185
+ # RedundantKeywordRestArgumentNames: kwargs, options, opts
186
+ # RedundantBlockArgumentNames: blk, block, proc
187
+ Style/ArgumentsForwarding:
188
+ Exclude:
189
+ - 'lib/site-inspector/endpoint.rb'
190
+ - 'lib/site-inspector/formatter.rb'
191
+
192
+ # Offense count: 1
193
+ # This cop supports unsafe autocorrection (--autocorrect-all).
194
+ Style/CollectionQuerying:
195
+ Exclude:
196
+ - 'lib/site-inspector/endpoint/dns.rb'
197
+
198
+ # Offense count: 2
199
+ # This cop supports safe autocorrection (--autocorrect).
200
+ # Configuration parameters: EnforcedStyle.
201
+ # SupportedStyles: braces, no_braces
202
+ Style/HashAsLastArrayItem:
203
+ Exclude:
204
+ - 'spec/site_inspector/endpoint/hsts_spec.rb'
205
+
206
+ # Offense count: 3
207
+ # This cop supports unsafe autocorrection (--autocorrect-all).
208
+ # Configuration parameters: AllowedReceivers.
209
+ # AllowedReceivers: Thread.current
210
+ Style/HashEachMethods:
211
+ Exclude:
212
+ - 'lib/site-inspector/endpoint/content.rb'
213
+ - 'lib/site-inspector/endpoint/well_known.rb'
214
+
215
+ # Offense count: 4
216
+ # This cop supports safe autocorrection (--autocorrect).
217
+ # Configuration parameters: AllowedMethods.
218
+ # AllowedMethods: infinite?, nonzero?
219
+ Style/RedundantCondition:
220
+ Exclude:
221
+ - 'lib/site-inspector/endpoint.rb'
222
+ - 'lib/site-inspector/endpoint/accessibility.rb'
223
+ - 'lib/site-inspector/endpoint/content.rb'
224
+ - 'lib/site-inspector/endpoint/well_known.rb'
225
+
226
+ # Offense count: 1
227
+ # This cop supports safe autocorrection (--autocorrect).
228
+ Style/RedundantLineContinuation:
229
+ Exclude:
230
+ - 'spec/site_inspector/endpoint/accessibility_spec.rb'
231
+
232
+ # Offense count: 2
233
+ # This cop supports unsafe autocorrection (--autocorrect-all).
234
+ # Configuration parameters: AllowedMethods, AllowedPatterns.
235
+ Style/ReturnNilInPredicateMethodDefinition:
236
+ Exclude:
237
+ - 'lib/site-inspector/endpoint/content.rb'
238
+
239
+ # Offense count: 1
240
+ # This cop supports safe autocorrection (--autocorrect).
241
+ # Configuration parameters: EnforcedStyle.
242
+ # SupportedStyles: single_quotes, double_quotes
243
+ Style/StringLiteralsInInterpolation:
244
+ Exclude:
245
+ - 'lib/site-inspector/formatter.rb'
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.6.6
1
+ 3.4.11
data/CHANGELOG.md ADDED
@@ -0,0 +1,71 @@
1
+ # Changelog
2
+
3
+ ## 4.0.0
4
+
5
+ First release since 3.2.0 (November 2020). It's a major version because several public APIs and output formats changed.
6
+
7
+ ### Breaking changes
8
+
9
+ - **Ruby 3.2 or later is required.** The gemspec now declares `required_ruby_version >= 3.2`. 3.2.0 had no constraint. CI runs on Ruby 3.2, 3.3, and 3.4.
10
+ - **The built-in cache classes are gone.** `SiteInspector::Cache`, `SiteInspector::DiskCache`, and `SiteInspector::RailsCache` were removed. `SiteInspector.cache` now returns a `Typhoeus::Cache::Rails` backed by an ActiveSupport cache store. Setting `CACHE=<dir>` still persists responses to disk (it now uses `ActiveSupport::Cache::FileStore`). Inside Rails, `Rails.cache` is used. Otherwise responses go to an in-memory `ActiveSupport::Cache::MemoryStore`. To supply your own store, use `SiteInspector.cache = Typhoeus::Cache::Rails.new(your_active_support_store)`. ([#109](https://github.com/benbalter/site-inspector/pull/109))
11
+ - **Check files moved** from `lib/site-inspector/checks/` to `lib/site-inspector/endpoint/`. The class names did not change (for example, `SiteInspector::Endpoint::Hsts` is still `SiteInspector::Endpoint::Hsts`). Code that required the files directly needs its path updated, for example `require 'site-inspector/checks/hsts'` becomes `require 'site-inspector/endpoint/hsts'`. `require 'site-inspector'` works as before. Core classes are now autoloaded.
12
+ - **`Endpoint#host` and `Domain#host` return `PublicSuffix::Domain` objects** instead of Strings. Call `#to_s` if you need a string. `Endpoint#host` also no longer strips a leading `www.`, so `Endpoint.new('https://www.example.com').host.to_s` is now `"www.example.com"`. `Domain#host` still strips it.
13
+ - **The library no longer loads dotenv.** `dotenv` was removed as a dependency. The `site-inspector` CLI still loads a `.env` file when the `dotenv` gem happens to be installed. Library users who relied on `.env` loading should `require 'dotenv/load'` themselves. ([#109](https://github.com/benbalter/site-inspector/pull/109))
14
+ - **`oj` was dropped** in favor of the standard library's `JSON`. ([#109](https://github.com/benbalter/site-inspector/pull/109))
15
+ - **Cookies are parsed with `http-cookie`.** `Cookies#all` and `Cookies#[]` now return `HTTP::Cookie` objects (use `#name`, `#value`, `#secure?`, `#httponly?`) instead of `CGI::Cookie` hashes. `Cookies#secure?` is now true only when a single cookie sets both `Secure` and `HttpOnly`. ([#109](https://github.com/benbalter/site-inspector/pull/109))
16
+ - **Headers check API and output changed.** `Headers#to_h` is now keyed by raw header name (`'strict-transport-security'`, `'content-security-policy'`, `'x-frame-options'`, `'server'`, `'x-xss-protection'`) and also includes any other `x-` headers the site sends. It used to be keyed by `:strict_transport_security`, `:click_jacking_protection`, and so on. `click_jacking_protection` / `click_jacking_protection?` were replaced by `frame_options` / `frame_options?`.
17
+ - **The Wappalyzer check uses the local `wappalyzer` CLI** (the npm package) instead of the hosted Wappalyzer API. `WAPPALYZER_API_KEY` is no longer used, and the check is disabled unless a `wappalyzer` binary is found on the `PATH`, in `./bin`, or in `./node_modules/.bin`. Category keys in its output are now snake_case symbols (for example `:web_servers`).
18
+ - **DNS queries no longer use `ANY`.** `Dns#records` queries A, AAAA, CNAME, MX, and DNSKEY explicitly through the Dnsruby resolver, and `Dns#query` now defaults to `'A'` instead of `'ANY'`. `Dns#ip` and `Dns#hostname` (PTR) are resolved through the same resolver instead of `Resolv`. ([#109](https://github.com/benbalter/site-inspector/pull/109))
19
+ - **The User-Agent is set with `Typhoeus::Config.user_agent`.** `SiteInspector.typhoeus_defaults` no longer includes a `:headers` key.
20
+ - **pa11y is looked up as `pa11y`** on the `PATH`, in `./bin`, or in `./node_modules/.bin`, instead of `pa11y.js` under the gem's own `node_modules`.
21
+ - **Several checks return `{}` for endpoints that are down or redirect.** This applies to content, cookies, sniffer, wappalyzer, accessibility, and well-known. The headers check returns `{}` for redirects.
22
+ - **Removed the Sniffer check and the `sniffles` dependency; use the Wappalyzer check for CMS/technology detection.** `SiteInspector::Endpoint::Sniffer`, the `--sniffer` CLI flag, and the `sniffer` output key are gone. ([#119](https://github.com/benbalter/site-inspector/pull/119))
23
+ - **`Domain#downgrades_https?` flags any HTTPS endpoint that redirects to HTTP**, including redirects to another host. Before, it only checked the canonical endpoint. ([#106](https://github.com/benbalter/site-inspector/pull/106))
24
+
25
+ ### Added
26
+
27
+ - `SiteInspector::Endpoint::WellKnown` check reports which `/.well-known/` URIs (listed in `lib/data/well-known.yml`) exist on an endpoint.
28
+ - The content check also looks for `security.txt` (at the root or under `/.well-known/`), a `vulnerability-disclosure-policy` page, and `data.json`.
29
+ - The HSTS check reports `preload_list_status` from the hstspreload.org API. This adds an outbound request.
30
+ - `SiteInspector::Formatter` renders inspection hashes as HTML tables.
31
+ - `SiteInspector::DomainParser` parses domains with `naughty_or_nice`.
32
+ - `Domain#to_h` includes `tld`, `sld`, and `trd`. `Endpoint#to_h` includes `resolves_to`.
33
+ - `Endpoint.build(domain, https:, www:)`, `Endpoint#build_request`, and `Endpoint#join`. Endpoints compare equal when their URIs match.
34
+ - The headers check exposes custom `x-` headers.
35
+ - `SiteInspector.logger`. `VERBOSE=1` logs each request and whether it hit the cache.
36
+
37
+ ### Changed
38
+
39
+ - `Domain#to_h`'s `host` is now the canonical endpoint's host.
40
+ - Domain and endpoint hosts are parsed with PublicSuffix / `naughty_or_nice`, and `www` is stripped with `PublicSuffix::Domain.new` instead of regexes.
41
+ - `proper_404s?` requires three random paths (bare, `.html`, and `.json`) to return exactly 404. Content paths are only reported when the site returns proper 404s.
42
+ - The content check follows redirects when it fetches the page body.
43
+ - HSTS handles responses with multiple `Strict-Transport-Security` headers.
44
+ - Checks within an endpoint run sequentially instead of in four threads, and `Endpoint#to_h` is memoized.
45
+ - The WHOIS and Wappalyzer checks handle timeouts instead of raising.
46
+ - The CLI emits JSON with `JSON.pretty_generate`.
47
+ - The gemspec has a new summary and metadata (`homepage_uri`, `source_code_uri`, `bug_tracker_uri`, `changelog_uri`, `rubygems_mfa_required`). ([#113](https://github.com/benbalter/site-inspector/pull/113))
48
+
49
+ ### Fixed
50
+
51
+ - `Endpoint#up?` had an operator precedence bug and crashed when there was no response. ([#109](https://github.com/benbalter/site-inspector/pull/109))
52
+ - Redirect `Location` headers are resolved per RFC 3986 with `Addressable::URI#join`, so protocol-relative, query-only, and dot-segment locations work. ([#109](https://github.com/benbalter/site-inspector/pull/109))
53
+ - `Dns#localhost?` uses `IPAddr#loopback?`, so it detects every loopback address (all of `127.0.0.0/8` and `::1`), not just `127.0.0.1`. ([#109](https://github.com/benbalter/site-inspector/pull/109))
54
+ - `Content#security_txt?` checks the correct `.well-known/security.txt` path. ([#109](https://github.com/benbalter/site-inspector/pull/109))
55
+ - The Wappalyzer check no longer raises `NameError` when the CLI output isn't JSON. It raises `SiteInspector::Endpoint::Wappalyzer::WappalyzerError` with the command output instead. ([#109](https://github.com/benbalter/site-inspector/pull/109))
56
+ - `Cliver::Dependency#version` is memoized as intended. ([#109](https://github.com/benbalter/site-inspector/pull/109))
57
+ - A `RailsCache` autoload that pointed to a missing file was removed. ([#109](https://github.com/benbalter/site-inspector/pull/109))
58
+
59
+ ### Dependencies
60
+
61
+ - Added: `activesupport` (>= 7.0), `csv` (~> 3.0), `http-cookie` (~> 1.0), `naughty_or_nice` (~> 2.0).
62
+ - Removed: `dotenv`, `oj`, `sniffles` ([#119](https://github.com/benbalter/site-inspector/pull/119)).
63
+ - `gman`: `~> 7.0, >= 7.0.4` became `>= 7.0.4, < 9`, which allows gman 8. ([#109](https://github.com/benbalter/site-inspector/pull/109))
64
+ - `nokogiri`: `~> 1.0` became `~> 1.10`.
65
+ - `public_suffix`: `~> 4.0` became `>= 4, < 6`. ([#92](https://github.com/benbalter/site-inspector/pull/92))
66
+ - Development: `rubocop-rspec` `~> 2.0` became `~> 3.0`.
67
+ - npm: added `wappalyzer` (now `^6.10.66`) alongside `pa11y`. ([#91](https://github.com/benbalter/site-inspector/pull/91), [#112](https://github.com/benbalter/site-inspector/pull/112))
68
+
69
+ ### Contributors
70
+
71
+ [@benbalter](https://github.com/benbalter) wrote most of this release. The Copilot coding agent opened [#106](https://github.com/benbalter/site-inspector/pull/106), and Dependabot sent the dependency bumps. No outside human contributors this time.
data/Gemfile CHANGED
@@ -2,6 +2,4 @@
2
2
 
3
3
  source 'https://rubygems.org'
4
4
 
5
- gem 'sniffles', github: 'wa0x6e/sniffles'
6
-
7
5
  gemspec
data/README.md CHANGED
@@ -2,11 +2,7 @@
2
2
 
3
3
  A Ruby Gem to sniff information about a domain's technology and capabilities.
4
4
 
5
- [![Gem Version](https://badge.fury.io/rb/site-inspector.svg)](http://badge.fury.io/rb/site-inspector) [![Build Status](https://travis-ci.org/benbalter/site-inspector.svg)](https://travis-ci.org/benbalter/site-inspector)
6
-
7
- ## Demo
8
-
9
- [site-inspector.herokuapp.com](https://site-inspector.herokuapp.com) ([source](https://github.com/benbalter/site-inspector-demo))
5
+ [![Gem Version](https://img.shields.io/gem/v/site-inspector)](https://rubygems.org/gems/site-inspector) [![CI](https://github.com/benbalter/site-inspector/actions/workflows/ci.yml/badge.svg)](https://github.com/benbalter/site-inspector/actions/workflows/ci.yml)
10
6
 
11
7
  ## Concepts
12
8
 
@@ -30,8 +26,8 @@ domain.www?
30
26
  # => true
31
27
  domain.canonical_endpoint.to_s
32
28
  # => "https://www.whitehouse.gov"
33
- domain.canonical_endpoint.sniffer.cms
34
- # => { :drupal => {}}
29
+ domain.canonical_endpoint.wappalyzer.to_h
30
+ # => { :cms => ["Drupal"], ... }
35
31
  ```
36
32
 
37
33
  ### Command line usage
@@ -46,7 +42,6 @@ Usage:
46
42
  Options:
47
43
  -j, --json JSON encode the output
48
44
  -a, --all return results for all endpoints (defaults to only the canonical endpoint)
49
- --sniffer return results for the sniffer check (defaults to all checks unless one or more checks are specified)
50
45
  --https return results for the https check (defaults to all checks unless one or more checks are specified)
51
46
  --hsts return results for the hsts check (defaults to all checks unless one or more checks are specified)
52
47
  --headers return results for the headers check (defaults to all checks unless one or more checks are specified)
@@ -136,16 +131,15 @@ Uses the `pa11y` CLI to run automated accessibility tests. Requires `node`. To i
136
131
  * `valid` - if the HTTPS response is valid
137
132
  * `return_code` - the HTTPS error, if any
138
133
 
139
- #### Sniffer
134
+ #### Wappalyzer
135
+
136
+ Detects the endpoint's CMS and other technologies (analytics, JavaScript libraries, advertising, web servers, and so on) with the [`wappalyzer`](https://www.npmjs.com/package/wappalyzer) CLI. Requires `node`. The check is only enabled when a `wappalyzer` binary is found on your `PATH`, in `./bin`, or in `./node_modules/.bin` (`npm install` in this repository installs it).
140
137
 
141
- * `cms` - the CMS used, if any
142
- * `analytics` - the analytics providers used, if any
143
- * `javascript` - the javascript libraries used, if any
144
- * `advertising` - the advertising providers used, if any
138
+ Returns a hash of technology names keyed by category, such as `cms`, `analytics`, or `javascript_libraries`.
145
139
 
146
140
  ## Adding your own check
147
141
 
148
- [Checks](https://github.com/benbalter/site-inspector/tree/master/lib/site-inspector/checks) are special classes that are children of [`SiteInspector::Endpoint::Check`](https://github.com/benbalter/site-inspector/blob/master/lib/site-inspector/checks/check.rb). You can implement your own check like this:
142
+ [Checks](https://github.com/benbalter/site-inspector/tree/main/lib/site-inspector/endpoint) are special classes that are children of [`SiteInspector::Endpoint::Check`](https://github.com/benbalter/site-inspector/blob/main/lib/site-inspector/endpoint/check.rb). You can implement your own check like this:
149
143
 
150
144
  ```ruby
151
145
  class SiteInspector
data/bin/site-inspector CHANGED
@@ -2,20 +2,20 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  require 'mercenary'
5
- require 'oj'
5
+ require 'json'
6
6
  require 'yaml'
7
7
  require 'colorator'
8
- require_relative '../lib/site-inspector'
9
8
 
10
- def stringify_keys_deep!(hash)
11
- hash.each_key do |k|
12
- ks = k.respond_to?(:to_s) ? k.to_s : k
13
- hash[ks] = hash.delete k # Preserve order even when k == ks
14
- stringify_keys_deep! h[ks] if hash[ks].is_a? Hash
15
- end
9
+ # Load a .env file if dotenv happens to be installed. It is not a dependency.
10
+ begin
11
+ require 'dotenv/load'
12
+ rescue LoadError
13
+ nil
16
14
  end
17
15
 
18
- Mercenary.program(:"site-inspector") do |p|
16
+ require_relative '../lib/site-inspector'
17
+
18
+ Mercenary.program(:'site-inspector') do |p|
19
19
  p.version SiteInspector::VERSION
20
20
  p.description "Returns information about a domain's technology and capabilities"
21
21
  p.syntax 'site-inspector <command> <domain> [options]'
@@ -36,14 +36,14 @@ Mercenary.program(:"site-inspector") do |p|
36
36
  # Build our domain hash as requested
37
37
  domain = SiteInspector.inspect(args[0])
38
38
  hash = domain.to_h(options)
39
- json = Oj.dump(hash, indent: 2, mode: :compat)
39
+ json = JSON.pretty_generate(hash)
40
40
 
41
41
  # Dump the JSON and run
42
42
  next puts json if options['json']
43
43
 
44
- # This is a dirty, dirty hack, but it's a simple way to stringify keys recursively
45
- # And format the output in a human-readable way
46
- yaml = YAML.dump Oj.load(json)
44
+ # Round-trip through JSON so keys and non-primitive values (symbols,
45
+ # classes) become plain strings before formatting as YAML
46
+ yaml = YAML.dump JSON.parse(json)
47
47
 
48
48
  # Colorize bools
49
49
  yaml.gsub!(/: (true|ok)$/, ": #{'true'.green}")
@@ -13,8 +13,8 @@ module Cliver
13
13
  def version
14
14
  return @version if defined? @version
15
15
 
16
- version = installed_versions.find { |p, _v| p == path }
17
- @detected_version = version.nil? ? nil : version[1]
16
+ detected = installed_versions.find { |p, _v| p == path }
17
+ @version = detected&.last
18
18
  end
19
19
 
20
20
  def major_version
@@ -0,0 +1,51 @@
1
+ ---
2
+ - acme-challenge
3
+ - amphtml
4
+ - ashrae
5
+ - assetlinks.json
6
+ - brski
7
+ - caldav
8
+ - carddav
9
+ - coap
10
+ - core
11
+ - csvm
12
+ - dnt
13
+ - dnt-policy.txt
14
+ - dots
15
+ - ecips
16
+ - enterprise-transport-security
17
+ - est
18
+ - genid
19
+ - gs1resolver
20
+ - hoba
21
+ - host-meta
22
+ - host-meta.json
23
+ - hosting-provider
24
+ - http-opportunistic
25
+ - idp-proxy
26
+ - jmap
27
+ - keybase.txt
28
+ - looking-glass
29
+ - matrix
30
+ - mta-sts.txt
31
+ - mud (deprecated)
32
+ - nfv-oauth-server-configuration
33
+ - ni
34
+ - oauth-authorization-server
35
+ - openid-configuration
36
+ - openorg
37
+ - pki-validation
38
+ - posh
39
+ - pvd
40
+ - reload-config
41
+ - repute-template
42
+ - resourcesync
43
+ - sshfp
44
+ - stun-key
45
+ - thread
46
+ - time
47
+ - timezone
48
+ - tor-relay
49
+ - uma2-configuration
50
+ - void
51
+ - webfinger