Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/quayio/scanner/image.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module Quayio
module Scanner
class Image
RELEVANT_SEVERITIES = %w[High Critical].freeze
QUAY_IO_REPO_NAME = %r{quay.io\/(?<org>[\w-]+)\/(?<repo>[\w-]+):(?<tag>[\w\.-]+)}.freeze
QUAY_IO_REPO_NAME = %r{quay.io\/(?<org>[\w-]+)\/(?<repo>[\w-]+):(?<tag>[\w.-]+)}.freeze

attr_reader :name, :whitelist, :repository

Expand Down
16 changes: 8 additions & 8 deletions lib/quayio/scanner/repository.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ module Scanner
Repository = Struct.new(:quayio_token, :org, :repo, :tag) do
MAX_ATTEMPTS = 5

def id
@id ||= fetch_id
end

def scan
api_call("/image/#{id}/security?vulnerabilities=true")
api_call("/manifest/#{manifest_ref}/security?vulnerabilities=true")
end

private

def fetch_id
result = api_call("/tag/#{tag}/images")
(result['images'].first)['id']
def manifest_ref
@manifest_ref ||= fetch_manifest_ref
end

def fetch_manifest_ref
result = api_call("/tag/?specificTag=#{tag}&onlyActiveTags=1")
(result['tags'].first)['manifest_digest']
end

def api_call(uri)
Expand Down