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
Joseph Schorr 17f3de811e Move route_show_if into decorators
Also removes unused route_hide_if
2017-07-20 11:07:31 -04:00

27 lines
760 B
Python

import logging
import json
import features
from app import secscan_notification_queue
from flask import request, make_response, Blueprint, abort
from endpoints.decorators import route_show_if
logger = logging.getLogger(__name__)
secscan = Blueprint('secscan', __name__)
@route_show_if(features.SECURITY_SCANNER)
@secscan.route('/notify', methods=['POST'])
def secscan_notification():
data = request.get_json()
logger.debug('Got notification from Security Scanner: %s', data)
if 'Notification' not in data:
abort(400)
notification = data['Notification']
name = ['named', notification['Name']]
if not secscan_notification_queue.alive(name):
secscan_notification_queue.put(name, json.dumps(notification))
return make_response('Okay')