Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
from data.database import DEFAULT_DATABASE
from lib.utils import parse_pagination_param
bp = Blueprint("review", __name__, url_prefix="/review")
db = DEFAULT_DATABASE
def serialize_enum(val):
return 's', val.name
def unserialize_enum(val):
return val
sqlakeysetserial.custom_serializations = {VulnerabilityState: serialize_enum}
sqlakeysetserial.custom_unserializations = {
VulnerabilityState: unserialize_enum
}
# Create a catch all route for profile identifiers.
@bp.route("/list")
@admin_required()
def list(vendor: str = None, profile: str = None):
entries = db.session.query(Vulnerability, Nvd)
entries = entries.filter(
Vulnerability.state != VulnerabilityState.PUBLISHED)
entries = entries.outerjoin(Vulnerability,
Nvd.cve_id == Vulnerability.cve_id)
entries = entries.order_by(asc(Vulnerability.state), desc(Nvd.id))