Class: Quayio::Scanner::Check
- Inherits:
-
Struct
- Object
- Struct
- Quayio::Scanner::Check
- Defined in:
- lib/quayio/scanner/check.rb
Instance Attribute Summary collapse
-
#docker_url ⇒ Object
Returns the value of attribute docker_url.
-
#quayio_token ⇒ Object
Returns the value of attribute quayio_token.
Instance Method Summary collapse
Instance Attribute Details
#docker_url ⇒ Object
Returns the value of attribute docker_url
6 7 8 |
# File 'lib/quayio/scanner/check.rb', line 6 def docker_url @docker_url end |
#quayio_token ⇒ Object
Returns the value of attribute quayio_token
6 7 8 |
# File 'lib/quayio/scanner/check.rb', line 6 def quayio_token @quayio_token end |
Instance Method Details
#run ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/quayio/scanner/check.rb', line 7 def run Docker.url = docker_url containers = Docker::Container.all .map { |dc| dc.json['Config']['Image'] } .uniq vulnerable_images = containers .map { |container| Image.new(container, quayio_token) } .select(&:vulnerable?) .map(&:name) if vulnerable_images.empty? [:ok, "#{containers.size} Containers are ok"] else [:critical, "The images are insecure: #{vulnerable_images.join(', ')}"] end end |