Skip to content

Commit 04346f2

Browse files
authored
Error handling improvements (canada-ca#1715)
1 parent 3656744 commit 04346f2

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

services/scanners/results/result_processor.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ def process_https(results, domain_key, db):
129129
else:
130130
https_status = "pass"
131131

132+
if domain.get("status", None) == None:
133+
domain.update({"status": {"https": "unknown", "ssl": "unknown", "dmarc": "unknown", "dkim": "unknown", "spf": "unknown"}})
132134
domain["status"]["https"] = https_status
133135
db.collection("domains").update(domain)
134136

@@ -224,11 +226,13 @@ def process_ssl(results, guidance, domain_key, db):
224226
{"_from": domain["_id"], "_to": sslEntry["_id"]}
225227
)
226228

227-
if len(negative_tags) > 0:
229+
if len(negative_tags) > 0 or "ssl5" not in positive_tags:
228230
ssl_status = "fail"
229-
elif "ssl5" in tags:
231+
else:
230232
ssl_status = "pass"
231233

234+
if domain.get("status", None) == None:
235+
domain.update({"status": {"https": "unknown", "ssl": "unknown", "dmarc": "unknown", "dkim": "unknown", "spf": "unknown"}})
232236
domain["status"]["ssl"] = ssl_status
233237
db.collection("domains").update(domain)
234238

@@ -393,7 +397,7 @@ def process_dns(results, domain_key, db):
393397
elif sp_tag == "reject":
394398
tags["dmarc"].append("dmarc19")
395399

396-
if results["spf"].get("missing", None) is not None:
400+
if (results["spf"].get("missing", None) is not None) or (results["spf"].get("record", "null") == "null"):
397401
tags["spf"].append("spf2")
398402
else:
399403
if results["spf"]["valid"]:
@@ -678,6 +682,9 @@ def process_dns(results, domain_key, db):
678682
else:
679683
dkim_status = "pass"
680684

685+
if domain.get("status", None) == None:
686+
domain.update({"status": {"https": "unknown", "ssl": "unknown", "dmarc": "unknown", "dkim": "unknown", "spf": "unknown"}})
687+
681688
for key, val in {
682689
"dkim": dkim_status,
683690
"dmarc": dmarc_status,

0 commit comments

Comments
 (0)