Skip to content

Commit 82a830d

Browse files
Merge pull request #9 from aboutsource/fix/api_schema_silent_changes
Adapt api requests to new manifest-based schema
2 parents bf40887 + 8ebdaaa commit 82a830d

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

lib/quayio/scanner/image.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module Quayio
22
module Scanner
33
class Image
44
RELEVANT_SEVERITIES = %w[High Critical].freeze
5-
QUAY_IO_REPO_NAME = %r{quay.io\/(?<org>[\w-]+)\/(?<repo>[\w-]+):(?<tag>[\w\.-]+)}.freeze
5+
QUAY_IO_REPO_NAME = %r{quay.io\/(?<org>[\w-]+)\/(?<repo>[\w-]+):(?<tag>[\w.-]+)}.freeze
66

77
attr_reader :name, :whitelist, :repository
88

lib/quayio/scanner/repository.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@ module Scanner
66
Repository = Struct.new(:quayio_token, :org, :repo, :tag) do
77
MAX_ATTEMPTS = 5
88

9-
def id
10-
@id ||= fetch_id
11-
end
12-
139
def scan
14-
api_call("/image/#{id}/security?vulnerabilities=true")
10+
api_call("/manifest/#{manifest_ref}/security?vulnerabilities=true")
1511
end
1612

1713
private
1814

19-
def fetch_id
20-
result = api_call("/tag/#{tag}/images")
21-
(result['images'].first)['id']
15+
def manifest_ref
16+
@manifest_ref ||= fetch_manifest_ref
17+
end
18+
19+
def fetch_manifest_ref
20+
result = api_call("/tag/?specificTag=#{tag}&onlyActiveTags=1")
21+
(result['tags'].first)['manifest_digest']
2222
end
2323

2424
def api_call(uri)

0 commit comments

Comments
 (0)