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

+16
View File
@@ -737,3 +737,19 @@ test('buildSummary has a sentence for the enforce case that names the file, not
assert.match(summary, /policy file says mode=enforce/);
assert.doesNotMatch(summary, /TXT record (protects|is enforcing)/);
});
test('a policy file cut off at the size limit is not judged, because half a policy reads like a whole one', () => {
// The header lines arrive before the mx: list, so a truncated file still parses. Claiming
// mode=enforce from it would promise protection the sender does not get.
const result = analyseMailTransport(
gatheredFixture({
mtaSts: { checked: true, present: true, valid: true, record: 'v=STSv1; id=20261110T000000', id: '20261110T000000', count: 1 },
policy: { ...policyOk(), truncated: true }
}),
{ now: NOW }
);
assert.ok(codes(result).includes('mta_sts_policy_truncated'));
assert.ok(!codes(result).includes('mta_sts_mode_enforce'));
assert.equal(result.findings.find((finding) => finding.code === 'mta_sts_policy_truncated').level, 'info');
assert.equal(result.state, 'not-evaluated');
});