aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJ08nY2022-10-19 09:51:32 +0200
committerJ08nY2022-10-19 09:51:32 +0200
commitc18eed5128b3aad991f4e9274418a8c3cebbd372 (patch)
tree535e8f3c8ac9d6a9db59b0a2f3bcd81be4d77250
parent3c6bd84a53cd1abc4a6159b0013f84aa0043c254 (diff)
downloadsec-certs-c18eed5128b3aad991f4e9274418a8c3cebbd372.tar.gz
sec-certs-c18eed5128b3aad991f4e9274418a8c3cebbd372.tar.zst
sec-certs-c18eed5128b3aad991f4e9274418a8c3cebbd372.zip
Fix FIPS references.
-rw-r--r--sec_certs/dataset/fips.py5
-rw-r--r--tests/data/settings_test.yaml22
-rw-r--r--tests/test_fips_oop.py6
3 files changed, 18 insertions, 15 deletions
diff --git a/sec_certs/dataset/fips.py b/sec_certs/dataset/fips.py
index 8b219124..8dd3e2e8 100644
--- a/sec_certs/dataset/fips.py
+++ b/sec_certs/dataset/fips.py
@@ -139,6 +139,7 @@ class FIPSDataset(Dataset[FIPSCertificate], ComplexSerializableType):
FIPSCertificate.convert_pdf_file, tuples, config.n_threads, progress_bar_desc="Converting to txt"
)
+ # TODO: this "test" parameter is nasty.
def _prepare_dataset(self, test: Optional[Path] = None, update: bool = False) -> Set[str]:
if test:
html_files = [test]
@@ -408,13 +409,13 @@ class FIPSDataset(Dataset[FIPSCertificate], ComplexSerializableType):
)
finder = DependencyFinder()
- finder.fit(self.certs, lambda cert: cert.cert_id, pdf_lookup) # type: ignore
+ finder.fit(self.certs, lambda cert: str(cert.cert_id), pdf_lookup) # type: ignore
for dgst in self.certs:
setattr(self.certs[dgst].heuristics, "st_references", finder.predict_single_cert(dgst, keep_unknowns=False))
finder = DependencyFinder()
- finder.fit(self.certs, lambda cert: cert.cert_id, web_lookup) # type: ignore
+ finder.fit(self.certs, lambda cert: str(cert.cert_id), web_lookup) # type: ignore
for dgst in self.certs:
setattr(
diff --git a/tests/data/settings_test.yaml b/tests/data/settings_test.yaml
index 5fd4aaca..6066a021 100644
--- a/tests/data/settings_test.yaml
+++ b/tests/data/settings_test.yaml
@@ -3,11 +3,13 @@ log_filepath:
description: Path to the file, relative to working directory, where the log will be stored
value: ./cert_processing_log.txt
smallest_certificate_id_to_connect:
- description: During validation we don't connect certificates with number lower than
+ description:
+ During validation we don't connect certificates with number lower than
_this_ to connections
value: 40
year_difference_between_validations:
- description: During validation we don't connect certificates with validation dates
+ description:
+ During validation we don't connect certificates with validation dates
difference higher than _this_
value: 7
n_threads:
@@ -15,16 +17,19 @@ n_threads:
value: 8
cpe_matching_threshold:
description: Level of required string similarity between CPE and certificate name on CC CPE matching, 0-100. Lower values yield more false negatives, higher values more false positives
- value: 70
+ value: 92
cpe_n_max_matches:
description: Maximum number of candidate CPE items that may be related to given certificate, >0
- value: 20
+ value: 99
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
@@ -32,8 +37,11 @@ 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
+ value: 3
enable_progress_bars:
description: Whether to enable pretty-printed progress bars while processing.
value: False
diff --git a/tests/test_fips_oop.py b/tests/test_fips_oop.py
index a851af7a..df5eb253 100644
--- a/tests/test_fips_oop.py
+++ b/tests/test_fips_oop.py
@@ -137,9 +137,6 @@ class TestFipsOOP(TestCase):
)
self.assertEqual(
- {"3615"}, set(dataset.certs[fips_dgst("3651")].heuristics.st_references.directly_referencing)
- )
- self.assertEqual(
{"3090", "3091"}, set(dataset.certs[fips_dgst("3093")].heuristics.st_references.directly_referencing)
)
@@ -189,9 +186,6 @@ class TestFipsOOP(TestCase):
set(dataset.certs[fips_dgst("3690")].heuristics.web_references.directly_referencing),
)
self.assertEqual(
- {"3615"}, set(dataset.certs[fips_dgst("3644")].heuristics.st_references.directly_referencing)
- )
- self.assertEqual(
{"3090", "3091"}, set(dataset.certs[fips_dgst("3527")].heuristics.st_references.directly_referencing)
)
self.assertEqual(