aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorJ08nY2024-10-16 23:10:22 +0200
committerJ08nY2024-10-16 23:10:22 +0200
commit3d887b3dfad2e217c3e5962f47f33793c4aa4a33 (patch)
treee6c3a17f5b2d5e637490a19867347fdda254fdac /src
parentc8c91a08e46387401d8211b4cd699b8295485f6b (diff)
downloadsec-certs-3d887b3dfad2e217c3e5962f47f33793c4aa4a33.tar.gz
sec-certs-3d887b3dfad2e217c3e5962f47f33793c4aa4a33.tar.zst
sec-certs-3d887b3dfad2e217c3e5962f47f33793c4aa4a33.zip
Fix mapping of certs to PPs broken due to CC URL change.
Diffstat (limited to 'src')
-rw-r--r--src/sec_certs/dataset/cc.py9
-rw-r--r--src/sec_certs/sample/cc.py2
2 files changed, 8 insertions, 3 deletions
diff --git a/src/sec_certs/dataset/cc.py b/src/sec_certs/dataset/cc.py
index ebffd912..79478d3d 100644
--- a/src/sec_certs/dataset/cc.py
+++ b/src/sec_certs/dataset/cc.py
@@ -872,7 +872,7 @@ class CCDataset(Dataset[CCCertificate, CCAuxiliaryDatasets], ComplexSerializable
) -> ProtectionProfileDataset:
"""
Downloads new snapshot of dataset with processed protection profiles (if it doesn't exist) and links PPs
- with certificates within self. Assigns PPs to all certificates
+ with certificates within self. Assigns PPs to all certificates, based on name and fname match.
:param bool to_download: If dataset should be downloaded or fetched from json, defaults to True
:param bool keep_metadata: If json related to the PP dataset should be kept on drive, defaults to True
@@ -886,10 +886,15 @@ class CCDataset(Dataset[CCCertificate, CCAuxiliaryDatasets], ComplexSerializable
else:
pp_dataset = ProtectionProfileDataset.from_json(self.pp_dataset_path)
+ # Map protection profiles to their name and file name for matching to certs.
+ pps = {(pp.pp_name, sanitization.sanitize_link_fname(pp.pp_link)): pp for pp in pp_dataset}
+
for cert in self:
if cert.protection_profiles is None:
raise RuntimeError("Building of the dataset probably failed - this should not be happening.")
- cert.protection_profiles = {pp_dataset.pps.get((x.pp_name, x.pp_link), x) for x in cert.protection_profiles}
+ cert.protection_profiles = {
+ pps.get((x.pp_name, sanitization.sanitize_link_fname(x.pp_link)), x) for x in cert.protection_profiles
+ }
if not keep_metadata:
self.pp_dataset_path.unlink()
diff --git a/src/sec_certs/sample/cc.py b/src/sec_certs/sample/cc.py
index d4bc73ae..aa145706 100644
--- a/src/sec_certs/sample/cc.py
+++ b/src/sec_certs/sample/cc.py
@@ -684,7 +684,7 @@ class CCCertificate(
@classmethod
def from_html_row(cls, row: Tag, status: str, category: str) -> CCCertificate:
"""
- Creates a CC sample from html row of commoncriteria.org webpage.
+ Creates a CC sample from html row of commoncriteriaportal.org webpage.
"""
cells = list(row.find_all("td"))