chelsea 0.0.26 → 0.0.31

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: 5e4509169b4bc0855e2ef590412aac149020c8506e430093285a1edc03f49652
4
- data.tar.gz: 894d2636f0966c8b288e31d8f40d265b1bf156c310622fd35c90852d46c1234e
3
+ metadata.gz: 8f6fed77cd96f3fd715030c654c03c5e480a9a46e40c76c7a4a5ae4d2016c681
4
+ data.tar.gz: e42fca3e172ce5937e90b09f7961d9a13b44d6fc9c1dd530f5b3f5fe19ec87df
5
5
  SHA512:
6
- metadata.gz: 35e878b35f6aa92d1ae68bf4d4e18b3eedcb08de41a7fc233b42c842b3ef440c6d89f26020f86990c4af9cd52cff73e83139046eeedff82fb9fadaeac954c944
7
- data.tar.gz: 946138b959b3eb119ffde5897b673002c2445549e7f48d1b0edfba50a338a8cecf14b3eb29c16ac166dfdec10a31885712563fd49a8bc01e5227a7975adc0c9b
6
+ metadata.gz: 1af02ec98ba340900a503b508d7f4cbf15c7cbd8643c27879db3db87608ac8d4cdbe7dad67b034a042f76d75548dbc17f2d546c760b0537e8e32fdfd1ce7bf9d
7
+ data.tar.gz: 27194d47997fc5bb332820a28d3c16ba58c31de0bae35cd8bad939c5e4efe76317cf3e3ee9a7091013745c26d995c65c50ac8e6825dad8dff38d4a8778a7b78a
data/.circleci/config.yml CHANGED
@@ -18,7 +18,7 @@ version: 2.1
18
18
  jobs:
19
19
  build:
20
20
  docker:
21
- - image: circleci/ruby:2.6.5-stretch
21
+ - image: circleci/ruby:2.6.6-stretch
22
22
  environment:
23
23
  BUNDLE_PATH: vendor/bundle
24
24
  steps:
@@ -35,7 +35,9 @@ jobs:
35
35
  - chelsea-bundle-v2-
36
36
  - run:
37
37
  name: Bundle Install
38
- command: bundle check --path vendor/bundle || bundle install
38
+ command: |
39
+ bundle config set --local path 'vendor/bundle'
40
+ bundle check || bundle install
39
41
  - save_cache:
40
42
  key: chelsea-bundle-v2-{{ checksum "Gemfile.lock" }}
41
43
  paths:
@@ -46,6 +48,9 @@ jobs:
46
48
  bundle exec rspec --format progress \
47
49
  --format RspecJunitFormatter \
48
50
  --out test_results/rspec.xml
51
+ - run:
52
+ name: Run linter
53
+ command: bundle exec rubocop
49
54
  - run:
50
55
  name: Build gem
51
56
  command: gem build chelsea.gemspec
@@ -62,7 +67,7 @@ jobs:
62
67
  path: test_results
63
68
  release:
64
69
  docker:
65
- - image: circleci/ruby:2.6.5-stretch
70
+ - image: circleci/ruby:2.6.6-stretch
66
71
  steps:
67
72
  - add_ssh_keys:
68
73
  fingerprints:
@@ -82,7 +87,7 @@ jobs:
82
87
  command: git config --global user.email "$GITHUB_EMAIL"
83
88
  - run:
84
89
  name: Set git upstream
85
- command: git branch -u origin/master
90
+ command: git branch -u origin/main
86
91
  - run:
87
92
  name: Bump version
88
93
  command: gem bump -v patch --tag --skip-ci --push
@@ -102,4 +107,4 @@ workflows:
102
107
  filters:
103
108
  branches:
104
109
  only:
105
- - master
110
+ - main
@@ -23,7 +23,7 @@ If applicable, add screenshots to help explain your problem.
23
23
 
24
24
  **Desktop (please complete the following information):**
25
25
  - OS: [e.g. OS X 1.13.6]
26
- - Ruby Version: [e.g. 2.6.5]
26
+ - Ruby Version: [e.g. 2.6.6]
27
27
  - Bundler Version: [e.g. 2.1.4]
28
28
  - chelsea Version [e.g. 0.0.11]
29
29
 
data/.rubocop.yml ADDED
@@ -0,0 +1,6 @@
1
+ AllCops:
2
+ NewCops: enable
3
+ TargetRubyVersion: 2.6.6
4
+
5
+ Metrics/BlockLength:
6
+ IgnoredMethods: ['Slop.parse']
data/Gemfile CHANGED
@@ -1,6 +1,11 @@
1
- source "https://rubygems.org"
1
+ # frozen_string_literal: true
2
2
 
3
- git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
3
+ source 'https://rubygems.org'
4
+
5
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
4
6
 
5
7
  # Specify your gem's dependencies in chelsea.gemspec
6
8
  gemspec
9
+
10
+ # linter
11
+ gem 'rubocop', require: false
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- chelsea (0.0.17)
4
+ chelsea (0.0.28)
5
5
  bundler (>= 1.2.0, < 3)
6
6
  ox (~> 2.13.2)
7
7
  pastel (~> 0.7.2)
@@ -16,31 +16,38 @@ GEM
16
16
  specs:
17
17
  addressable (2.7.0)
18
18
  public_suffix (>= 2.0.2, < 5.0)
19
+ ast (2.4.2)
19
20
  byebug (11.1.2)
20
21
  crack (0.4.3)
21
22
  safe_yaml (~> 1.0.0)
22
23
  diff-lcs (1.3)
23
24
  domain_name (0.5.20190701)
24
25
  unf (>= 0.0.5, < 1.0.0)
25
- equatable (0.6.1)
26
+ equatable (0.7.0)
26
27
  hashdiff (1.0.1)
27
28
  http-cookie (1.0.3)
28
29
  domain_name (~> 0.5)
29
30
  mime-types (3.3.1)
30
31
  mime-types-data (~> 3.2015)
31
- mime-types-data (3.2020.0512)
32
- necromancer (0.6.0)
32
+ mime-types-data (3.2021.0225)
33
+ necromancer (0.7.0)
33
34
  netrc (0.11.0)
34
- ox (2.13.2)
35
+ ox (2.13.4)
36
+ parallel (1.20.1)
37
+ parser (3.0.1.0)
38
+ ast (~> 2.4.1)
35
39
  pastel (0.7.4)
36
40
  equatable (~> 0.6)
37
41
  tty-color (~> 0.5)
38
42
  public_suffix (4.0.3)
43
+ rainbow (3.0.0)
39
44
  rake (12.3.3)
45
+ regexp_parser (2.1.1)
40
46
  rest-client (2.0.2)
41
47
  http-cookie (>= 1.0.2, < 2.0)
42
48
  mime-types (>= 1.16, < 4.0)
43
49
  netrc (~> 0.8)
50
+ rexml (3.2.5)
44
51
  rspec (3.9.0)
45
52
  rspec-core (~> 3.9.0)
46
53
  rspec-expectations (~> 3.9.0)
@@ -56,17 +63,29 @@ GEM
56
63
  rspec-support (3.9.2)
57
64
  rspec_junit_formatter (0.4.1)
58
65
  rspec-core (>= 2, < 4, != 2.12.0)
66
+ rubocop (1.12.1)
67
+ parallel (~> 1.10)
68
+ parser (>= 3.0.0.0)
69
+ rainbow (>= 2.2.2, < 4.0)
70
+ regexp_parser (>= 1.8, < 3.0)
71
+ rexml
72
+ rubocop-ast (>= 1.2.0, < 2.0)
73
+ ruby-progressbar (~> 1.7)
74
+ unicode-display_width (>= 1.4.0, < 3.0)
75
+ rubocop-ast (1.4.1)
76
+ parser (>= 2.7.1.5)
77
+ ruby-progressbar (1.11.0)
59
78
  safe_yaml (1.0.5)
60
- slop (4.8.1)
79
+ slop (4.8.2)
61
80
  strings (0.1.8)
62
81
  strings-ansi (~> 0.1)
63
82
  unicode-display_width (~> 1.5)
64
83
  unicode_utils (~> 1.4)
65
84
  strings-ansi (0.2.0)
66
- tty-color (0.5.1)
85
+ tty-color (0.6.0)
67
86
  tty-cursor (0.7.1)
68
87
  tty-font (0.5.0)
69
- tty-screen (0.8.0)
88
+ tty-screen (0.8.1)
70
89
  tty-spinner (0.9.3)
71
90
  tty-cursor (~> 0.7)
72
91
  tty-table (0.11.0)
@@ -94,6 +113,7 @@ DEPENDENCIES
94
113
  rake (~> 12.3)
95
114
  rspec (~> 3.0)
96
115
  rspec_junit_formatter (~> 0.4.1)
116
+ rubocop
97
117
  webmock (~> 3.8.3)
98
118
 
99
119
  BUNDLED WITH
data/README.md CHANGED
@@ -167,12 +167,279 @@ Run tests:
167
167
  bundle exec rspec
168
168
  ```
169
169
 
170
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
170
+ To install this gem onto your local machine, run `bundle exec rake install`. To manually release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
171
+
172
+ ### Release Process
173
+
174
+ Chelsea is automatically released after a commit to the `master` branch.
175
+
176
+ To avoid performing a release after a commit to the `master` branch, be sure your commit message includes `[skip ci] `.
171
177
 
172
178
  ## Why Chelsea?
173
179
 
174
180
  One of the awesome developers at Sonatype was thinking of names, and came upon the [Chelsea filter](https://en.wikipedia.org/wiki/Chelsea_filter). A Chelsea filter is used to separate gemstones, helping gemologists distinguish between real emeralds, and just regular green glass. We felt this tool helps you do something very similar, looking at your RubyGems, and seeing which are pristine, and which are less than ok at the moment.
175
181
 
182
+ ## How to Fix Vulnerabilities
183
+
184
+ So you've found a vulnerability. Now what? The best case is to upgrade the vulnerable component to a newer/non-vulnerable
185
+ version. However, it is likely the vulnerable component is not a direct dependency, but instead is a transitive dependency
186
+ (a dependency of a dependency, of a dependency, wash-rinse-repeat). In such a case, the first step is to figure out which
187
+ direct dependency (and sub-dependencies) depend on the vulnerable component.
188
+
189
+ The `gem dependency` command will show a dependency tree for all gems from the current Gemfile with their dependencies.
190
+ The `bundle outdated` command will show a list of all gems which have newer versions.
191
+
192
+ As an example, suppose we've learned that component `rexml`, version 3.2.4 is vulnerable (CVE-2021-28965).
193
+ Use the following command to determine which components depend on `rexml`.
194
+ ```shell
195
+ $ gem dependency -R rexml
196
+ Gem rexml-3.1.9
197
+ bundler (>= 0, development)
198
+ rake (>= 0, development)
199
+ Used by
200
+ rubocop-1.9.0 (rexml (>= 0))
201
+
202
+ Gem rexml-3.2.4
203
+ bundler (>= 0, development)
204
+ rake (>= 0, development)
205
+ Used by
206
+ rubocop-1.9.0 (rexml (>= 0))
207
+ ```
208
+
209
+ There are a number of approaches to resolving the vulnerability, but no matter which approach you choose, you should
210
+ probably make sure all the tests are passing before making any dependency changes.
211
+ ```shell
212
+ bundle exec rspec
213
+ ...
214
+ Finished in 0.1411 seconds (files took 0.67222 seconds to load)
215
+ 22 examples, 0 failures
216
+ ```
217
+
218
+ One approach is to upgrade everything to the latest version available. This solution might make people nervous about
219
+ introducing breaking changes. (You have unit tested everything right? ;) )
220
+ <details>
221
+ <summary>Click to expand output of command:
222
+
223
+ ```shell
224
+ $ bundle update
225
+ ```
226
+ </summary>
227
+
228
+ ```shell
229
+ $ bundle update
230
+ Fetching gem metadata from https://rubygems.org/.........
231
+ Fetching gem metadata from https://rubygems.org/.
232
+ Resolving dependencies...
233
+ Using rake 12.3.3
234
+ Using public_suffix 4.0.6 (was 4.0.3)
235
+ Using addressable 2.7.0
236
+ Using ast 2.4.2
237
+ Using bundler 2.1.4
238
+ Using byebug 11.1.3 (was 11.1.2)
239
+ Using ox 2.13.4
240
+ Using equatable 0.7.0 (was 0.6.1)
241
+ Using tty-color 0.6.0 (was 0.5.2)
242
+ Using pastel 0.7.4
243
+ Using unf_ext 0.0.7.7
244
+ Using unf 0.1.4
245
+ Using domain_name 0.5.20190701
246
+ Using http-cookie 1.0.3
247
+ Using mime-types-data 3.2021.0225 (was 3.2020.0512)
248
+ Using mime-types 3.3.1
249
+ Using netrc 0.11.0
250
+ Using rest-client 2.0.2
251
+ Using slop 4.8.2
252
+ Using tty-font 0.5.0
253
+ Using tty-cursor 0.7.1
254
+ Using tty-spinner 0.9.3
255
+ Using necromancer 0.7.0 (was 0.6.0)
256
+ Using strings-ansi 0.2.0
257
+ Using unicode-display_width 1.7.0
258
+ Using unicode_utils 1.4.0
259
+ Using strings 0.1.8
260
+ Using tty-screen 0.8.1
261
+ Using tty-table 0.11.0
262
+ Using chelsea 0.0.28 (was 0.0.27) from source at `.`
263
+ Using rexml 3.2.5 (was 3.2.4)
264
+ Using crack 0.4.5 (was 0.4.3)
265
+ Using diff-lcs 1.4.4 (was 1.3)
266
+ Using hashdiff 1.0.1
267
+ Using parallel 1.20.1
268
+ Using parser 3.0.1.0 (was 3.0.0.0)
269
+ Using rainbow 3.0.0
270
+ Using regexp_parser 2.1.1 (was 2.0.3)
271
+ Using rspec-support 3.10.2 (was 3.9.2)
272
+ Using rspec-core 3.10.1 (was 3.9.1)
273
+ Using rspec-expectations 3.10.1 (was 3.9.1)
274
+ Using rspec-mocks 3.10.2 (was 3.9.1)
275
+ Using rspec 3.10.0 (was 3.9.0)
276
+ Using rspec_junit_formatter 0.4.1
277
+ Using rubocop-ast 1.4.1
278
+ Using ruby-progressbar 1.11.0
279
+ Using rubocop 1.12.1 (was 1.9.0)
280
+ Using webmock 3.8.3
281
+ Bundle updated!
282
+ Gems in the group production were not updated.
283
+ ```
284
+ </details>
285
+
286
+ Perhaps a more palatable approach would be to upgrade to a newer version of the "Used by" component, meaning you upgrade
287
+ the direct dependency (`rubocop`) to a version that does not depend on a vulnerable version of the transitive dependency
288
+ (`rexml`). This approach will make fewer changes overall.
289
+
290
+ In some cases, no such upgrade of the direct dependency exists that avoids a dependence on the vulnerable component.
291
+ In such a case, the next step is to file an issue with the direct dependency project for them to update the vulnerable
292
+ sub-dependencies. Be sure to read and follow any vulnerability reporting instructions published by the project: Look for
293
+ a `SECURITY.md` file, or other instructions on how to report vulnerabilities. Some projects may prefer you not report
294
+ the vulnerability publicly.
295
+
296
+ In our example, there is a newer version of the direct dependency available:
297
+ ```shell
298
+ $ bundle outdated | grep rubocop
299
+ * rubocop (newest 1.12.1, installed 1.9.0) in group "default"
300
+ ```
301
+ Now we can update the `rubocop` component as follows:
302
+ <details>
303
+ <summary>Click to expand output of command:
304
+
305
+ ```shell
306
+ $ bundle update rubocop
307
+ ```
308
+ </summary>
309
+
310
+ ```shell
311
+ $ bundle update rubocop
312
+ Fetching gem metadata from https://rubygems.org/.........
313
+ Fetching gem metadata from https://rubygems.org/.
314
+ Resolving dependencies...
315
+ Using rake 12.3.3
316
+ Fetching public_suffix 4.0.3
317
+ Installing public_suffix 4.0.3
318
+ Using addressable 2.7.0
319
+ Using ast 2.4.2
320
+ Using bundler 2.1.4
321
+ Fetching byebug 11.1.2
322
+ Installing byebug 11.1.2 with native extensions
323
+ Using ox 2.13.4
324
+ Using equatable 0.6.1
325
+ Using tty-color 0.5.2
326
+ Using pastel 0.7.4
327
+ Using unf_ext 0.0.7.7
328
+ Using unf 0.1.4
329
+ Using domain_name 0.5.20190701
330
+ Using http-cookie 1.0.3
331
+ Using mime-types-data 3.2020.0512
332
+ Using mime-types 3.3.1
333
+ Using netrc 0.11.0
334
+ Using rest-client 2.0.2
335
+ Using slop 4.8.2
336
+ Using tty-font 0.5.0
337
+ Using tty-cursor 0.7.1
338
+ Using tty-spinner 0.9.3
339
+ Using necromancer 0.6.0
340
+ Using strings-ansi 0.2.0
341
+ Using unicode-display_width 1.7.0
342
+ Using unicode_utils 1.4.0
343
+ Using strings 0.1.8
344
+ Using tty-screen 0.8.1
345
+ Using tty-table 0.11.0
346
+ Using chelsea 0.0.28 from source at `.`
347
+ Using safe_yaml 1.0.5
348
+ Fetching crack 0.4.3
349
+ Installing crack 0.4.3
350
+ Fetching diff-lcs 1.3
351
+ ```
352
+ </details>
353
+
354
+ Yet another alternative approach is to upgrade the transitive dependency (`rexml` in our example).
355
+
356
+ Use the command below to determine if there is a newer version of the vulnerable component.
357
+ ```shell
358
+ $ bundle outdated | grep rexml
359
+ * rexml (newest 3.2.5, installed 3.2.4)
360
+ ```
361
+ Now we can update the `rexml` component as follows:
362
+ <details>
363
+ <summary>Click to expand output of command:
364
+
365
+ ```shell
366
+ $ bundle update rexml
367
+ ```
368
+ </summary>
369
+
370
+ ```shell
371
+ $ bundle update rexml
372
+ Fetching gem metadata from https://rubygems.org/.........
373
+ Fetching gem metadata from https://rubygems.org/.
374
+ Resolving dependencies...
375
+ Using rake 12.3.3
376
+ Using public_suffix 4.0.3
377
+ Using addressable 2.7.0
378
+ Using ast 2.4.2
379
+ Using bundler 2.1.4
380
+ Using byebug 11.1.2
381
+ Using ox 2.13.4
382
+ Using equatable 0.7.0 (was 0.6.1)
383
+ Using tty-color 0.6.0 (was 0.5.2)
384
+ Using pastel 0.7.4
385
+ Using unf_ext 0.0.7.7
386
+ Using unf 0.1.4
387
+ Using domain_name 0.5.20190701
388
+ Using http-cookie 1.0.3
389
+ Using mime-types-data 3.2021.0225 (was 3.2020.0512)
390
+ Using mime-types 3.3.1
391
+ Using netrc 0.11.0
392
+ Using rest-client 2.0.2
393
+ Using slop 4.8.2
394
+ Using tty-font 0.5.0
395
+ Using tty-cursor 0.7.1
396
+ Using tty-spinner 0.9.3
397
+ Using necromancer 0.7.0 (was 0.6.0)
398
+ Using strings-ansi 0.2.0
399
+ Using unicode-display_width 1.7.0
400
+ Using unicode_utils 1.4.0
401
+ Using strings 0.1.8
402
+ Using tty-screen 0.8.1
403
+ Using tty-table 0.11.0
404
+ Using chelsea 0.0.28 (was 0.0.27) from source at `.`
405
+ Using safe_yaml 1.0.5
406
+ Using crack 0.4.3
407
+ Using diff-lcs 1.3
408
+ Using hashdiff 1.0.1
409
+ Using parallel 1.20.1
410
+ Using parser 3.0.0.0
411
+ Using rainbow 3.0.0
412
+ Using regexp_parser 2.0.3
413
+ Using rexml 3.2.5 (was 3.2.4)
414
+ Using rspec-support 3.9.2
415
+ Using rspec-core 3.9.1
416
+ Using rspec-expectations 3.9.1
417
+ Using rspec-mocks 3.9.1
418
+ Using rspec 3.9.0
419
+ Using rspec_junit_formatter 0.4.1
420
+ Using rubocop-ast 1.4.1
421
+ Using ruby-progressbar 1.11.0
422
+ Using rubocop 1.9.0
423
+ Using webmock 3.8.3
424
+ Bundle updated!
425
+ Gems in the group production were not updated.
426
+ ```
427
+ </details>
428
+
429
+ Regardless of which approach you choose, you should verify the tests pass after you upgrade dependencies.
430
+ ```shell
431
+ bundle exec rspec
432
+ ...
433
+ Finished in 0.12826 seconds (files took 0.5069 seconds to load)
434
+ 22 examples, 0 failures
435
+ ```
436
+ Full disclosure, it turns out that after upgrading `rubocop` (via: `bundle update rubocop`),
437
+ a `# rubocop:disable Layout/LineLength` was no longer needed.
438
+ Happily, the CI test suite failed and pointed quickly to the fix (just needed to remove `# rubocop`
439
+ disable/enable comments).
440
+
441
+ Victory! Commit the changes, and we're done. (see [PR: #44](https://github.com/sonatype-nexus-community/chelsea/pull/44))
442
+
176
443
  ## Contributing
177
444
 
178
445
  We care a lot about making the world a safer place, and that's why we created `chelsea`. If you as well want to speed up the pace of software development by working on this project, jump on in! Before you start work, create a new issue, or comment on an existing issue, to let others know you are!