Ready for demo
This commit is contained in:
parent
75173d5573
commit
b408cfd2cc
7 changed files with 94 additions and 80 deletions
|
@ -65,7 +65,8 @@ class RepositoryTagVulnerabilities(RepositoryParamResource):
|
|||
'security_indexed': False
|
||||
}
|
||||
|
||||
data = _call_security_api('layers/%s/vulnerabilities', tag_image.docker_image_id,
|
||||
data = _call_security_api('layers/%s.%s/vulnerabilities', tag_image.docker_image_id,
|
||||
tag_image.storage.uuid,
|
||||
minimumPriority=args.minimumPriority)
|
||||
|
||||
return {
|
||||
|
@ -79,7 +80,7 @@ class RepositoryTagVulnerabilities(RepositoryParamResource):
|
|||
@path_param('repository', 'The full path of the repository. e.g. namespace/name')
|
||||
@path_param('imageid', 'The image ID')
|
||||
class RepositoryImagePackages(RepositoryParamResource):
|
||||
""" Operations for listing the packages added/removed in an image. """
|
||||
""" Operations for listing the packages in an image. """
|
||||
|
||||
@require_repo_read
|
||||
@nickname('getRepoImagePackages')
|
||||
|
@ -94,7 +95,8 @@ class RepositoryImagePackages(RepositoryParamResource):
|
|||
'security_indexed': False
|
||||
}
|
||||
|
||||
data = _call_security_api('layers/%s/packages/diff', repo_image.docker_image_id)
|
||||
data = _call_security_api('layers/%s.%s/packages', repo_image.docker_image_id,
|
||||
repo_image.storage.uuid)
|
||||
|
||||
return {
|
||||
'security_indexed': True,
|
||||
|
|
|
@ -13,14 +13,17 @@ sec = Blueprint('sec', __name__)
|
|||
@sec.route('/notification', methods=['POST'])
|
||||
def sec_notification():
|
||||
data = request.get_json()
|
||||
print data
|
||||
|
||||
# Find all tags that contain the layer(s) introducing the vulnerability.
|
||||
# TODO: remove this check once fixed.
|
||||
if not 'IntroducingLayersIDs' in data['Content']:
|
||||
return make_response('Okay')
|
||||
|
||||
layer_ids = data['Content']['IntroducingLayersIDs']
|
||||
# TODO: fix this for the image_id.storage thing properly.
|
||||
layer_ids = [full_id.split('.')[0] for full_id in data['Content']['IntroducingLayersIDs']]
|
||||
if not layer_ids:
|
||||
return make_response('Okay')
|
||||
|
||||
tags = model.tag.get_matching_tags(layer_ids, RepositoryTag, Repository, Image)
|
||||
|
||||
# For any repository that has a notification setup, issue a notification.
|
||||
|
|
Reference in a new issue