1
0
mirror of https://github.com/quay/quay.git synced 2026-01-27 18:42:52 +03:00
Files
quay/util/secscan/validator.py
Kenny Lee Sin Cheong 5f63b3a7bb chore: drop deprecated tables and remove unused code (PROJQUAY-522) (#2089)
* chore: drop deprecated tables and remove unused code

* isort imports

* migration: check for table existence before drop
2023-08-25 12:17:24 -04:00

30 lines
869 B
Python

import logging
logger = logging.getLogger(__name__)
class V4SecurityConfigValidator(object):
"""
Helper class for validating the V4 security scanner configuration.
"""
def __init__(self, feature_sec_scan, sec_scan_endpoint):
self._feature_sec_scan = feature_sec_scan
self._sec_scan_endpoint = sec_scan_endpoint
def valid(self):
if not self._feature_sec_scan:
return False
if self._sec_scan_endpoint is None:
logger.debug("Missing SECURITY_SCANNER_V4_ENDPOINT configuration")
return False
if not self._sec_scan_endpoint.startswith(
"http://"
) and not self._sec_scan_endpoint.startswith("https://"):
logger.debug("SECURITY_SCANNER_V4_ENDPOINT configuration must start with http or https")
return False
return True