This repository has been archived on 2020-03-24. You can view files and clone it, but cannot push or open issues or pull requests.
quay/endpoints/secscan.py

26 lines
740 B
Python
Raw Normal View History

import logging
2015-11-10 00:17:15 +00:00
import json
import features
2015-11-10 00:17:15 +00:00
from app import secscan_notification_queue
from flask import request, make_response, Blueprint
from endpoints.common import route_show_if
logger = logging.getLogger(__name__)
secscan = Blueprint('secscan', __name__)
@route_show_if(features.SECURITY_SCANNER)
@secscan.route('/notification', methods=['POST'])
def secscan_notification():
data = request.get_json()
logger.debug('Got notification from Clair: %s', data)
content = data['Content']
layer_ids = content.get('NewIntroducingLayersIDs', content.get('IntroducingLayersIDs', []))
if not layer_ids:
return make_response('Okay')
2015-11-10 00:17:15 +00:00
secscan_notification_queue.put(data['Name'], json.dumps(data))
return make_response('Okay')