diff options
| author | Ján Jančár | 2024-10-19 12:09:39 +0200 |
|---|---|---|
| committer | GitHub | 2024-10-19 12:09:39 +0200 |
| commit | e2ec7f031341bb78a76167620feae4d91dc3c932 (patch) | |
| tree | 06b3f3f9171c20ec240785f095f470b728ddf760 /src | |
| parent | 2a3d45cd8068d79ebbe281ee7b46bd150b4058ca (diff) | |
| parent | 8e0f9dcc1eb3fafa6d446e9db44191b447e6dc78 (diff) | |
| download | sec-certs-e2ec7f031341bb78a76167620feae4d91dc3c932.tar.gz sec-certs-e2ec7f031341bb78a76167620feae4d91dc3c932.tar.zst sec-certs-e2ec7f031341bb78a76167620feae4d91dc3c932.zip | |
Merge pull request #447 from crocs-muni/fix/notebooks-aux-dsets
Avoid double serialization in CVE and CPE dataset load.
Diffstat (limited to 'src')
| -rw-r--r-- | src/sec_certs/dataset/cc.py | 5 | ||||
| -rw-r--r-- | src/sec_certs/dataset/dataset.py | 9 | ||||
| -rw-r--r-- | src/sec_certs/dataset/fips.py | 5 | ||||
| -rw-r--r-- | src/sec_certs/sample/cc.py | 5 |
4 files changed, 11 insertions, 13 deletions
diff --git a/src/sec_certs/dataset/cc.py b/src/sec_certs/dataset/cc.py index 4c1114f3..ba2ffb58 100644 --- a/src/sec_certs/dataset/cc.py +++ b/src/sec_certs/dataset/cc.py @@ -269,9 +269,8 @@ class CCDataset(Dataset[CCCertificate, CCAuxiliaryDatasets], ComplexSerializable Optionally stores it at the given path (a directory) and also downloads auxiliary datasets and artifacts (PDFs). - :::{note} - Note that including the auxiliary datasets adds several gigabytes and including artifacts adds tens of gigabytes. - ::: + .. note:: + Note that including the auxiliary datasets adds several gigabytes and including artifacts adds tens of gigabytes. :param path: Path to a directory where to store the dataset, or `None` if it should not be stored. :param auxiliary_datasets: Whether to also download auxiliary datasets (CVE, CPE, CPEMatch datasets). diff --git a/src/sec_certs/dataset/dataset.py b/src/sec_certs/dataset/dataset.py index 2da2bdc4..c906fd59 100644 --- a/src/sec_certs/dataset/dataset.py +++ b/src/sec_certs/dataset/dataset.py @@ -193,9 +193,8 @@ class Dataset(Generic[CertSubType, AuxiliaryDatasetsSubType], ComplexSerializabl Optionally stores it at the given path (a directory) and also downloads auxiliary datasets and artifacts (PDFs). - :::{note} - Note that including the auxiliary datasets adds several gigabytes and including artifacts adds tens of gigabytes. - ::: + .. note:: + Note that including the auxiliary datasets adds several gigabytes and including artifacts adds tens of gigabytes. :param archive_url: The URL of the full dataset archive. :param snapshot_url: The URL of the full dataset snapshot. @@ -437,10 +436,10 @@ class Dataset(Generic[CertSubType, AuxiliaryDatasetsSubType], ComplexSerializabl logger.info("Fetching new CPE records from NVD API.") with CpeNvdDatasetBuilder(api_key=config.nvd_api_key) as builder: cpe_dataset = builder.build_dataset(cpe_dataset) + cpe_dataset.to_json() else: logger.info("Preparing CPEDataset from sec-certs.org.") cpe_dataset = CPEDataset.from_web(self.cpe_dataset_path) - cpe_dataset.to_json() return cpe_dataset @@ -462,10 +461,10 @@ class Dataset(Generic[CertSubType, AuxiliaryDatasetsSubType], ComplexSerializabl logger.info("Fetching new CVE records from NVD API.") with CveNvdDatasetBuilder(api_key=config.nvd_api_key) as builder: cve_dataset = builder.build_dataset(cve_dataset) + cve_dataset.to_json() else: logger.info("Preparing CVEDataset from sec-certs.org") cve_dataset = CVEDataset.from_web(self.cve_dataset_path) - cve_dataset.to_json() return cve_dataset diff --git a/src/sec_certs/dataset/fips.py b/src/sec_certs/dataset/fips.py index eeaec0a0..0feb920f 100644 --- a/src/sec_certs/dataset/fips.py +++ b/src/sec_certs/dataset/fips.py @@ -228,9 +228,8 @@ class FIPSDataset(Dataset[FIPSCertificate, FIPSAuxiliaryDatasets], ComplexSerial Optionally stores it at the given path (a directory) and also downloads auxiliary datasets and artifacts (PDFs). - :::{note} - Note that including the auxiliary datasets adds several gigabytes and including artifacts adds tens of gigabytes. - ::: + .. note:: + Note that including the auxiliary datasets adds several gigabytes and including artifacts adds tens of gigabytes. :param path: Path to a directory where to store the dataset, or `None` if it should not be stored. :param auxiliary_datasets: Whether to also download auxiliary datasets (CVE, CPE, CPEMatch datasets). diff --git a/src/sec_certs/sample/cc.py b/src/sec_certs/sample/cc.py index aa145706..63c2cca5 100644 --- a/src/sec_certs/sample/cc.py +++ b/src/sec_certs/sample/cc.py @@ -484,7 +484,8 @@ class CCCertificate( @property def actual_sars(self) -> set[SAR] | None: """ - Computes actual SARs. First, SARs implied by EAL are computed. Then, these are augmented with heuristically extracted SARs + Computes actual SARs. First, SARs implied by EAL are computed. Then, these are augmented with heuristically extracted SARs. + :return Optional[Set[SAR]]: Set of actual SARs of a certificate, None if empty """ sars = {} @@ -543,7 +544,7 @@ class CCCertificate( def merge(self, other: CCCertificate, other_source: str | None = None) -> None: """ Merges with other CC sample. Assuming they come from different sources, e.g., csv and html. - Assuming that html source has better protection profiles, they overwrite CSV info + Assuming that html source has better protection profiles, they overwrite CSV info. On other values the sanity checks are made. """ if self != other: |
