aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_report.py
AgeCommit message (Collapse)AuthorFilesLines
33 hoursfix: fold a role mailbox's case, and test the half that was not testedDanilo M.1-5/+98
"Abuse@Host.Invalid" and "abuse@host.invalid" produced two destinations and two mails to one desk, which is the duplicate-mail behaviour the grouping exists to prevent. The root cause is the test, not the grouping. _group_key folded the domain correctly, but the test written for it used a lowercase local part in both of its inputs, so it varied only the half that worked and passed while the other half was never exercised. A test that varies one half of its input proves nothing about the other. The local part now folds for the RFC 2142 role mailboxes. That RFC mandates those names and requires them matched case-insensitively, so no host runs "Abuse@" and "abuse@" as different desks and treating them as two costs a duplicate mail with nothing on the other side of the trade. This reverses the earlier decision only for the standardised names: any other local part is still left as published, because for a named mailbox folding could merge two desks a host genuinely distinguishes, and a dropped desk is worse than a duplicate. Each half now folds on the strength of its own standard. Both folds are mutation-checked and killed by distinct tests, so neither masks the other, and the role fold is checked across all five role names. Also pins two behaviours that held only by luck: the caller's contacts are not modified, and a destination's ioc list is not aliased to the contact's. Both are true today because the grouping starts a fresh list, and nothing would have caught an implementation that reused the contact's. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Xj1ayFRSUQ2u7cwb3S4axE
34 hoursfix: derive a destination id from its address, not its positionDanilo M.1-19/+93
A positional id names a slot in one run's list, and report may run again on a case whose contacts have changed since. A newly resolved indicator whose desk sorts ahead renumbers every desk after it, so bodies/<id>.xarf on disk comes to belong to a different desk than the manifest entry sharing that id. The body hash recorded per destination would then compare one desk's body against another's, reporting an edit nobody made or missing one that was. Hashing the address makes an id follow the desk. It hashes the same normalised form the grouping uses, so two spellings of one desk share an id rather than letting whichever spelling RDAP published first decide a body's filename. Eight hex chars is a deliberate ceiling: collision probability is about 1e-8 at ten desks, and a short id keeps a case directory readable to the person reviewing it. Also strengthens two tests that passed against trivially wrong code: the no-address case now asserts alongside a contact that does resolve, so returning nothing at all is no longer a passing answer, and the two-address case asserts the ioc lists and distinct ids rather than the sorted targets alone. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Xj1ayFRSUQ2u7cwb3S4axE
34 hoursfeat: group abuse contacts into one destination per addressDanilo M.1-0/+143
Two contacts can resolve to the same desk, an IP and a domain at one hoster being the common case, and grouping per contact would send that desk two mails about one incident. The domain half of an address is folded to lowercase before grouping, since it is case-insensitive by definition; the local part is left verbatim, because only the receiving host knows whether it folds, and folding two desks a host distinguishes would silently drop one. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Xj1ayFRSUQ2u7cwb3S4axE