aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_config.py
AgeCommit message (Collapse)AuthorFilesLines
28 hoursfeat: read which reporting destinations are configuredDanilo M.1-0/+58
Adds DESTINATION_KEYS and two Config fields, destinations and incomplete, so config.load() reports which of misp/abusedb/urlhaus have every required key filled with a non-empty string. A half-filled MISP pair is reported as data via incomplete, never raised: parse and contacts load this same file and read neither key, and report (task 6) is the one that will refuse it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0176FYdVfpzUq8S9jecqQqL6
34 hoursfeat: read the reporter identity from configDanilo M.1-1/+169
The reporter's identity is the one identifier this tool discloses deliberately, so it comes from config only and parse never supplies it. An empty value is absent, the same rule the rest of the config follows. Three departures from the plan, each a defect in its code: A non-string value is REJECTED, not dropped. The plan filtered on isinstance(value, str), so name = 42 or email = ["a@b"] silently vanished and read back as not-configured. This file already learned that lesson from ipaddress.ip_network(42) returning a valid-looking 0.0.0.42/32: a wrong value that reads as plausible is worse than an error. Dropping the email would strip the reply address from every report while the user believed they were identified, so the typo is reported against the file that holds it, the way a non-string trusted_relays entry already is. The value is stored STRIPPED. The plan tested value.strip() for truthiness but stored the original, so name = " A Reporter " reached the From display name as "From: A Reporter <...>", verbatim and unquoted. Only the three keys the spec names are carried across, and text_part no longer subscripts them. Each key is individually skippable and config drops a skipped one, so a partial identity is the normal shape, yet text_part read identity['name'] and identity['org'] directly: a config naming only an email raised KeyError on a case that had parsed perfectly. The "Reported by:" line is now joined from the parts present, so a missing org leaves no stray comma. A wholly unconfigured identity still raises in build(); how to refuse that belongs to the cli task, not here. The dataclass field defaults to an empty dict rather than editing every construction site, and the mutable-dict-in-a-frozen-dataclass is left as is: report only reads it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LByBnw83xr9YP85nskzkyE
3 daysfix: reject non-list relays and empty cases valuesDanilo M.1-0/+29
An empty cases string resolved to Path("") = cwd, scattering evidence wherever the command happened to run. A string trusted_relays (easy to hand-write without brackets) iterated as characters, failing on '1' with an error naming nothing findable in the file. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KphFXTc2QajxXsHWyvGJ4R
3 daysfeat: read and validate the configDanilo M.1-0/+88
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KphFXTc2QajxXsHWyvGJ4R