Report invalid records in summary

This commit is contained in:
nemunaire 2025-10-30 12:59:37 +07:00
commit b01ca9b38c

View file

@ -130,6 +130,25 @@
} }
} }
// SPF DNS record check
const spfRecords = report.dns_results?.spf_records;
if (spfRecords && spfRecords.length > 0) {
const invalidSpfRecords = spfRecords.filter((r) => !r.valid && r.record);
if (invalidSpfRecords.length > 0) {
segments.push({ text: ". Your SPF record" });
if (invalidSpfRecords.length > 1) {
segments.push({ text: "s are " });
} else {
segments.push({ text: " is " });
}
segments.push({
text: "invalid",
highlight: { color: "danger", bold: true },
link: "#dns-spf",
});
}
}
// IP Reverse DNS (iprev) check // IP Reverse DNS (iprev) check
const iprevResult = report.authentication?.iprev; const iprevResult = report.authentication?.iprev;
if (iprevResult) { if (iprevResult) {
@ -217,6 +236,28 @@
} }
} }
// DKIM DNS record check
const dkimRecords = report.dns_results?.dkim_records;
if (dkimRecords && Object.keys(dkimRecords).length > 0) {
const invalidDkimKeys = Object.entries(dkimRecords)
.filter(([_, record]) => !record.valid && record.record)
.map(([key, _]) => key);
if (invalidDkimKeys.length > 0) {
segments.push({ text: ". Your DKIM record" });
if (invalidDkimKeys.length > 1) {
segments.push({ text: "s are " });
} else {
segments.push({ text: " is " });
}
segments.push({
text: "invalid",
highlight: { color: "danger", bold: true },
link: "#dns-dkim",
});
}
}
// DMARC policy check // DMARC policy check
const dmarcRecord = report.dns_results?.dmarc_record; const dmarcRecord = report.dns_results?.dmarc_record;
if (dmarcRecord) { if (dmarcRecord) {
@ -235,9 +276,9 @@
segments.push({ text: "none", highlight: { monospace: true, bold: true } }); segments.push({ text: "none", highlight: { monospace: true, bold: true } });
segments.push({ text: "' policy", highlight: { bold: true } }); segments.push({ text: "' policy", highlight: { bold: true } });
} else if (!dmarcRecord.valid) { } else if (!dmarcRecord.valid) {
segments.push({ text: ". Your DMARC record has " }); segments.push({ text: ". Your DMARC record is " });
segments.push({ segments.push({
text: "issues", text: "invalid",
highlight: { color: "danger", bold: true }, highlight: { color: "danger", bold: true },
link: "#dns-dmarc", link: "#dns-dmarc",
}); });