quayio-scanner 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/quayio/scanner/image.rb +17 -8
- data/lib/quayio/scanner/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5df176d74b68e0b31a5408b2be36bac9c0cb2171650acb160cfedd90a143de2c
|
4
|
+
data.tar.gz: aab6b7098d7a848294613428d8b514589c949f5d9f1fdf9041af06932d12856c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1da63def2a66714fff1b69b709150b444a0b149f7da03c1a9bcdec87f895a1b73a44887d9ded63c928dca958f5edc82ecc06a074957c3103f96958dccb0f2183
|
7
|
+
data.tar.gz: a0c809340d55c456aa639ecebe00926722ece6f156efee325f713fcb25ef371ca8cc44ad828665767175f31fce558300665eb976ebbb8d9d8ac346d386cd1b96
|
data/lib/quayio/scanner/image.rb
CHANGED
@@ -5,6 +5,7 @@ module Quayio
|
|
5
5
|
module Scanner
|
6
6
|
class Image < Struct.new(:name, :quayio_token, :whitelist)
|
7
7
|
RELEVANT_SEVERITIES = %w(High Critical)
|
8
|
+
MAX_ATTEMPTS = 5
|
8
9
|
|
9
10
|
def vulnerable?
|
10
11
|
quayio? && image_exists? && scanned? && high_vulnerabilities_present?
|
@@ -44,14 +45,22 @@ module Quayio
|
|
44
45
|
def raw_image
|
45
46
|
return @raw_image if defined? @raw_image
|
46
47
|
|
47
|
-
|
48
|
-
|
49
|
-
RestClient.get(
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
48
|
+
(1..MAX_ATTEMPTS).each do |attempt|
|
49
|
+
begin
|
50
|
+
response = RestClient.get(
|
51
|
+
"https://quay.io/api/v1/repository/#{repo}/tag/#{tag}/images",
|
52
|
+
authorization: "Bearer #{quayio_token}",
|
53
|
+
accept: :json)
|
54
|
+
rescue RestClient::ExceptionWithResponse => err
|
55
|
+
return nil if err.http_code == 404 # ignore unknown repos
|
56
|
+
if err.http_code == 520 and attempt < MAX_ATTEMPTS
|
57
|
+
sleep(rand(10))
|
58
|
+
next
|
59
|
+
end
|
60
|
+
raise err
|
61
|
+
end
|
62
|
+
@raw_image = JSON.parse(response)['images'].first
|
63
|
+
return @raw_image
|
55
64
|
end
|
56
65
|
end
|
57
66
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quayio-scanner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Benjamin Meichsner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-01-
|
11
|
+
date: 2020-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: docker-api
|