diff options
| author | Adam Janovsky | 2022-10-10 14:47:44 +0200 |
|---|---|---|
| committer | Adam Janovsky | 2022-10-10 14:47:44 +0200 |
| commit | 4fa0e396f02c5628eeef2f14eacbdd716c9bcd5c (patch) | |
| tree | ab788f2f6bfd5796693b833478f6bd9e02d370a1 | |
| parent | 9df0bc005ccc8cf8f3c449caff086c3cca07da49 (diff) | |
| parent | 4886206b650fba8924f15ebc342dd9628a551649 (diff) | |
| download | sec-certs-4fa0e396f02c5628eeef2f14eacbdd716c9bcd5c.tar.gz sec-certs-4fa0e396f02c5628eeef2f14eacbdd716c9bcd5c.tar.zst sec-certs-4fa0e396f02c5628eeef2f14eacbdd716c9bcd5c.zip | |
Merge branch 'main' into feat/revisit-vulns
| -rw-r--r-- | sec_certs/config/settings-schema.json | 4 | ||||
| -rw-r--r-- | sec_certs/config/settings.yaml | 9 | ||||
| -rw-r--r-- | sec_certs/dataset/protection_profile.py | 10 |
3 files changed, 15 insertions, 8 deletions
diff --git a/sec_certs/config/settings-schema.json b/sec_certs/config/settings-schema.json index c4871096..7e40a0ac 100644 --- a/sec_certs/config/settings-schema.json +++ b/sec_certs/config/settings-schema.json @@ -137,6 +137,9 @@ "cc_maintenances_latest_snapshot": { "$ref": "#/definitions/settings_url_entry" }, + "pp_latest_snapshot": { + "$ref": "#/definitions/settings_url_entry" + }, "ignore_first_page": { "$ref": "#/definitions/settings_boolean_entry" }, @@ -170,6 +173,7 @@ "cpe_n_max_matches", "cc_latest_snapshot", "cc_maintenances_latest_snapshot", + "pp_latest_snapshot", "ignore_first_page", "cert_threshold", "fips_latest_snapshot", diff --git a/sec_certs/config/settings.yaml b/sec_certs/config/settings.yaml index 2325955b..c6d54242 100644 --- a/sec_certs/config/settings.yaml +++ b/sec_certs/config/settings.yaml @@ -22,11 +22,14 @@ cpe_n_max_matches: description: Maximum number of candidate CPE items that may be related to given certificate, >0 value: 100 cc_latest_snapshot: - description: Url from where to fetch the latest snapshot of fully processed CC dataset + description: URL from where to fetch the latest snapshot of fully processed CC dataset value: https://seccerts.org/cc/dataset.json cc_maintenances_latest_snapshot: - description: Url from where to fetch the latest snapshot of CC maintenance updates + description: URL from where to fetch the latest snapshot of CC maintenance updates value: https://seccerts.org/cc/maintenance_updates.json +pp_latest_snapshot: + description: URL from where to fetch the latest snapshot of the PP dataset + value: https://seccerts.org/static/pp.json ignore_first_page: description: During keyword search, first page usually contains addresses - ignore it. value: true @@ -34,7 +37,7 @@ cert_threshold: description: Used with --higher-precision-results. Determines the amount of mismatched algorithms to be considered faulty. value: 5 fips_latest_snapshot: - description: Url for the latest snapshot of FIPS dataset + description: URL for the latest snapshot of FIPS dataset value: https://seccerts.org/fips/dataset.json minimal_token_length: description: Minimal length of a string that will be considered as a token during keyword extraction in CVE matching diff --git a/sec_certs/dataset/protection_profile.py b/sec_certs/dataset/protection_profile.py index c71f98b5..58ea2044 100644 --- a/sec_certs/dataset/protection_profile.py +++ b/sec_certs/dataset/protection_profile.py @@ -3,9 +3,10 @@ import logging import tempfile from dataclasses import dataclass from pathlib import Path -from typing import ClassVar, Dict, Optional, Tuple, Union +from typing import Dict, Optional, Tuple, Union import sec_certs.utils.helpers as helpers +from sec_certs.config.configuration import config from sec_certs.sample.protection_profile import ProtectionProfile logger = logging.getLogger(__name__) @@ -13,8 +14,6 @@ logger = logging.getLogger(__name__) @dataclass class ProtectionProfileDataset: - static_dataset_url: ClassVar[str] = "https://ajanovsky.cz/pp_data_complete_processed.json" - pps: Dict[Tuple[str, Optional[str]], ProtectionProfile] def __iter__(self): @@ -48,12 +47,13 @@ class ProtectionProfileDataset: @classmethod def from_web(cls, store_dataset_path: Optional[Path] = None): - logger.info(f"Downloading static PP dataset from: {cls.static_dataset_url}") + + logger.info(f"Downloading static PP dataset from: {config.pp_latest_snapshot}") if not store_dataset_path: tmp = tempfile.TemporaryDirectory() store_dataset_path = Path(tmp.name) / "pp_dataset.json" - helpers.download_file(cls.static_dataset_url, store_dataset_path) + helpers.download_file(config.pp_latest_snapshot, store_dataset_path) obj = cls.from_json(store_dataset_path) if not store_dataset_path: |
