fix(check): two false-confident answers neither author could see from inside the module

mail-transport recorded truncation but never surfaced it, so a policy file cut off at the 32 KB
limit could still be reported as mode=enforce from a partial parse. hardening's CAA comparison
matched issuer tokens blindly, so a certificate naming only its profile (CN: R11, no O) against a
CAA record for another CA produced "a renewal would be refused" out of nothing. Both now say
they could not judge instead.
This commit is contained in:
hoelee committed 2026-11-10 19:32:51 +08:00
1 parent 8925d10424
commit 85ec724928
4 files changed
+72

No files matched your search

+25
View File
@@ -671,3 +671,28 @@ test('no scenario in this file can reach state "fail"', () => {
assert.ok(['ok', 'warn', 'not-evaluated'].includes(result.state));
}
});
test('a CAA mismatch is never claimed from a profile identifier like R11', () => {
// Let's Encrypt certificates often carry only "R11"/"E6" as CN, with no O and no company name.
// Comparing that to a CAA record naming another CA would invent "your renewal would be refused".
const result = analyseHardening(
facts({
certificate: { issuer: { CN: 'R11' } },
caa: { name: 'example.com', records: [{ critical: 0, issue: 'digicert.com' }] }
}),
{ now: NOW }
);
assert.equal(result.findings.find((f) => f.code === 'hardening_caa_issuer_mismatch'), undefined);
assert.ok(result.findings.some((f) => f.code === 'hardening_caa_not_compared'));
});
test('a real company name still produces the mismatch warning', () => {
const result = analyseHardening(
facts({
certificate: { issuer: LETS_ENCRYPT },
caa: { name: 'example.com', records: [{ critical: 0, issue: 'digicert.com' }] }
}),
{ now: NOW }
);
assert.ok(result.findings.some((f) => f.code === 'hardening_caa_issuer_mismatch'));
});