1
0
mirror of https://github.com/quay/quay.git synced 2026-01-26 06:21:37 +03:00
Files
quay/endpoints/secscan.py
2019-12-02 12:23:08 -05:00

35 lines
906 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, anon_allowed
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")
@secscan.route("/_internal_ping")
@anon_allowed
def internal_ping():
return make_response("true", 200)