From 1d59095460036e6081d49fca5ea010dc93b91c20 Mon Sep 17 00:00:00 2001 From: Jimmy Zelinskie Date: Wed, 18 Jan 2017 16:34:36 -0500 Subject: [PATCH] utils.secscan: linter fixes --- util/secscan/__init__.py | 158 +++++++++++++++++++------------------- util/secscan/analyzer.py | 5 +- util/secscan/validator.py | 4 +- 3 files changed, 85 insertions(+), 82 deletions(-) diff --git a/util/secscan/__init__.py b/util/secscan/__init__.py index 738b1f57a..1e3ac04aa 100644 --- a/util/secscan/__init__.py +++ b/util/secscan/__init__.py @@ -1,98 +1,98 @@ # NOTE: This objects are used directly in the external-notification-data and vulnerability-service # on the frontend, so be careful with changing their existing keys. PRIORITY_LEVELS = { - 'Unknown': { - 'title': 'Unknown', - 'index': 6, - 'level': 'info', - 'color': '#9B9B9B', - 'score': 0, + 'Unknown': { + 'title': 'Unknown', + 'index': 6, + 'level': 'info', + 'color': '#9B9B9B', + 'score': 0, - 'description': 'Unknown is either a security problem that has not been assigned ' + - 'to a priority yet or a priority that our system did not recognize', - 'banner_required': False - }, + 'description': 'Unknown is either a security problem that has not been assigned to a priority' + + ' yet or a priority that our system did not recognize', + 'banner_required': False + }, - 'Negligible': { - 'title': 'Negligible', - 'index': 5, - 'level': 'info', - 'color': '#9B9B9B', - 'score': 1, + 'Negligible': { + 'title': 'Negligible', + 'index': 5, + 'level': 'info', + 'color': '#9B9B9B', + 'score': 1, - 'description': 'Negligible is technically a security problem, but is only theoretical ' + - 'in nature, requires a very special situation, has almost no install base, ' + - 'or does no real damage.', - 'banner_required': False - }, + 'description': 'Negligible is technically a security problem, but is only theoretical ' + + 'in nature, requires a very special situation, has almost no install base, ' + + 'or does no real damage.', + 'banner_required': False + }, - 'Low': { - 'title': 'Low', - 'index': 4, - 'level': 'warning', - 'color': '#F8CA1C', - 'score': 3, + 'Low': { + 'title': 'Low', + 'index': 4, + 'level': 'warning', + 'color': '#F8CA1C', + 'score': 3, - 'description': 'Low is a security problem, but is hard to exploit due to environment, ' + - 'requires a user-assisted attack, a small install base, or does very ' + - 'little damage.', - 'banner_required': False - }, + 'description': 'Low is a security problem, but is hard to exploit due to environment, ' + + 'requires a user-assisted attack, a small install base, or does very little' + + ' damage.', + 'banner_required': False + }, - 'Medium': { - 'title': 'Medium', - 'value': 'Medium', - 'index': 3, - 'level': 'warning', - 'color': '#FCA657', - 'score': 6, + 'Medium': { + 'title': 'Medium', + 'value': 'Medium', + 'index': 3, + 'level': 'warning', + 'color': '#FCA657', + 'score': 6, - 'description': 'Medium is a real security problem, and is exploitable for many people. ' + - 'Includes network daemon denial of service attacks, cross-site scripting, ' + - 'and gaining user privileges.', - 'banner_required': False - }, + 'description': 'Medium is a real security problem, and is exploitable for many people. ' + + 'Includes network daemon denial of service attacks, cross-site scripting, and ' + + 'gaining user privileges.', + 'banner_required': False + }, - 'High': { - 'title': 'High', - 'value': 'High', - 'index': 2, - 'level': 'warning', - 'color': '#F77454', - 'score': 9, + 'High': { + 'title': 'High', + 'value': 'High', + 'index': 2, + 'level': 'warning', + 'color': '#F77454', + 'score': 9, - 'description': 'High is a real problem, exploitable for many people in a default installation. ' + - 'Includes serious remote denial of services, local root privilege escalations, ' + - 'or data loss.', - 'banner_required': False - }, + 'description': 'High is a real problem, exploitable for many people in a default ' + + 'installation. Includes serious remote denial of services, local root ' + + 'privilege escalations, or data loss.', + 'banner_required': False + }, - 'Critical': { - 'title': 'Critical', - 'value': 'Critical', - 'index': 1, - 'level': 'error', - 'color': '#D64456', - 'score': 10, + 'Critical': { + 'title': 'Critical', + 'value': 'Critical', + 'index': 1, + 'level': 'error', + 'color': '#D64456', + 'score': 10, - 'description': 'Critical is a world-burning problem, exploitable for nearly all people in ' + - 'a installation of the package. Includes remote root privilege escalations, ' + - 'or massive data loss.', - 'banner_required': False - }, + 'description': 'Critical is a world-burning problem, exploitable for nearly all people in ' + + 'a installation of the package. Includes remote root privilege escalations, ' + + 'or massive data loss.', + 'banner_required': False + }, - 'Defcon1': { - 'title': 'Defcon 1', - 'value': 'Defcon1', - 'index': 0, - 'level': 'error', - 'color': 'black', - 'score': 11, + 'Defcon1': { + 'title': 'Defcon 1', + 'value': 'Defcon1', + 'index': 0, + 'level': 'error', + 'color': 'black', + 'score': 11, - 'description': 'Defcon1 is a Critical problem which has been manually highlighted ' + - 'by the Quay team. It requires immediate attention.', - 'banner_required': True - } + 'description': 'Defcon1 is a Critical problem which has been manually highlighted by the Quay' + + ' team. It requires immediate attention.', + 'banner_required': True + } } diff --git a/util/secscan/analyzer.py b/util/secscan/analyzer.py index 924aff3c1..674ae212d 100644 --- a/util/secscan/analyzer.py +++ b/util/secscan/analyzer.py @@ -1,10 +1,10 @@ import logging import logging.config -import features - from collections import defaultdict +import features + from endpoints.notificationhelper import spawn_notification from data.database import ExternalNotificationEvent, IMAGE_NOT_SCANNED_ENGINE_VERSION, Image from data.model.tag import filter_tags_have_repository_event, get_tags_for_image @@ -13,6 +13,7 @@ from util.secscan.api import (APIRequestFailure, AnalyzeLayerException, MissingP InvalidLayerException, AnalyzeLayerRetryException) from util.morecollections import AttrDict + logger = logging.getLogger(__name__) diff --git a/util/secscan/validator.py b/util/secscan/validator.py index 845d8e4b0..d8eb61c01 100644 --- a/util/secscan/validator.py +++ b/util/secscan/validator.py @@ -1,6 +1,8 @@ -import features import logging +import features + + logger = logging.getLogger(__name__)