Add certificate details modal and fix SSL/TLS data processing

- Add certificate details modal to scan detail page with subject, issuer,
  validity dates, serial number, self-signed indicator, SANs, and TLS
  version support with expandable cipher suites
- Fix bug where certificate data was not being saved to database due to
  incorrect path lookup (was checking http_info['certificate'] instead of
  http_info['ssl_tls']['certificate'])
- Update requirements: add sslyze 6.0.0 and upgrade cryptography to >=42.0.0
  to fix 'No module named cryptography.x509.verification' error
This commit is contained in:
2025-11-20 10:38:02 -06:00
parent 8d8e53c903
commit 73a3b95834
3 changed files with 170 additions and 7 deletions

View File

@@ -449,9 +449,10 @@ class ScanService:
# Process certificate and TLS info if present
http_info = service_data.get('http_info', {})
if http_info.get('certificate'):
ssl_tls = http_info.get('ssl_tls', {})
if ssl_tls.get('certificate'):
self._process_certificate(
http_info['certificate'],
ssl_tls,
scan_obj.id,
service.id
)
@@ -489,16 +490,19 @@ class ScanService:
return service
return None
def _process_certificate(self, cert_data: Dict[str, Any], scan_id: int,
def _process_certificate(self, ssl_tls_data: Dict[str, Any], scan_id: int,
service_id: int) -> None:
"""
Process certificate and TLS version data.
Args:
cert_data: Certificate data dictionary
ssl_tls_data: SSL/TLS data dictionary containing 'certificate' and 'tls_versions'
scan_id: Scan ID
service_id: Service ID
"""
# Extract certificate data from ssl_tls structure
cert_data = ssl_tls_data.get('certificate', {})
# Create ScanCertificate record
cert = ScanCertificate(
scan_id=scan_id,
@@ -516,7 +520,7 @@ class ScanService:
self.db.flush()
# Process TLS versions
tls_versions = cert_data.get('tls_versions', {})
tls_versions = ssl_tls_data.get('tls_versions', {})
for version, version_data in tls_versions.items():
tls = ScanTLSVersion(
scan_id=scan_id,