Commit Graph

28 Commits

Author SHA1 Message Date
Sean Whalen d7366d088f Add DMARCbis report support; rename forensic→failure project-wide
Rebased on top of master @ 2cda5bf (9.9.0), which added the ASN
source attribution work (#712, #713, #714, #715). Individual Copilot
iteration commits squashed into this single commit — the per-commit
history on the feature branch was iterative (add tests, fix lint,
move field, revert, etc.) and not worth preserving; GitHub squash-
merges PRs anyway.

### DMARCbis fields (new)

New fields from the DMARCbis XSD, plumbed through types, parsing, CSV
output, and the Elasticsearch / OpenSearch mappings:

- ``np`` — non-existent subdomain policy (``none`` / ``quarantine`` /
  ``reject``)
- ``testing`` — testing mode flag (``n`` / ``y``), replaces RFC 7489
  ``pct``
- ``discovery_method`` — policy discovery method (``psl`` /
  ``treewalk``)
- ``generator`` — report generator software identifier (metadata)
- ``human_result`` — optional descriptive text on DKIM / SPF results

RFC 7489 reports parse with ``None`` for DMARCbis-only fields.

### Forensic → failure rename

Forensic reports have been renamed to failure reports throughout the
project to reflect the proper naming since RFC 7489.

- Core: ``types.py``, ``__init__.py`` — ``ForensicReport`` →
  ``FailureReport``, ``parse_forensic_report`` →
  ``parse_failure_report``, report type ``"failure"``.
- Output modules: ``elastic.py``, ``opensearch.py``, ``splunk.py``,
  ``kafkaclient.py``, ``syslog.py``, ``gelf.py``, ``webhook.py``,
  ``loganalytics.py``, ``s3.py``.
- CLI: ``cli.py`` — args, config keys, index names
  (``dmarc_failure``).
- Docs + dashboards: all markdown, Grafana JSON, Kibana NDJSON,
  Splunk XML.

Backward compatibility preserved: old function / type names remain as
aliases (``parse_forensic_report = parse_failure_report``,
``ForensicReport = FailureReport``, etc.), CLI accepts both the old
(``save_forensic``, ``forensic_topic``) and new (``save_failure``,
``failure_topic``) config keys, and updated dashboards query both
old and new index / sourcetype names so data from before and after
the rename appears together.

### Rebase notes

Merge conflicts resolved in ``parsedmarc/constants.py`` (took bis's
10.0.0 bump), ``parsedmarc/__init__.py`` (combined bis's "failure"
wording with master's IPinfo MMDB mention), ``parsedmarc/elastic.py``
and ``parsedmarc/opensearch.py`` (kept master's ``source_asn`` /
``source_asn_name`` / ``source_asn_domain`` on the failure doc path
while renaming ``forensic_report`` → ``failure_report``), and
``CHANGELOG.md`` (10.0.0 entry now sits above the 9.9.0 entry).

All 324 tests pass; ``ruff check`` / ``ruff format --check`` clean.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-23 02:26:30 -04:00
Sean Whalen b530d624e6 Add example google SMTP-TLS report email 2024-09-04 20:03:51 -04:00
pphillips99 410663dbca fixup and tests to extract_report() to handle documented inputs (#530) 2024-07-16 14:53:27 -04:00
Lennart Friberg 91191e30f3 Fix if base_domain is None before get_service_from_reverse_dns_base_d… (#514)
* Fix if base_domain is None before get_service_from_reverse_dns_base_domain call

- Added if statement for base_domain before getting get_service_from_reverse_dns_base_domain(). If base_domain is None, get_service_from_reverse_dns_base_domain() will fail the report.
- Added .xml test file

* Create protection.outlook.com!example.com!1711756800!1711843200.xml

added .xml test sample report where base_domain return none
2024-05-22 08:36:13 -04:00
yuji suzuki 201280d700 Fixed ci for Test sample DMARC reports (#520)
* Fixed ci for Test sample DMARC reports

* pip install local local folder

* pip install path fix
2024-05-22 08:14:04 -04:00
Russel Hunter Yukawa 7aa2e14cbb Fix for deadlock with large report (#508)
* add large xml sample

* Avoid deadlock

* Remove extra  whitespaces
2024-05-22 08:10:59 -04:00
cgoIT f3206dcdab [SMTP TLS] some minor bug fixes (#477)
* fix minor bugs during smtp-tls parsing, add docker-compose for local elasticsearch, add smtp-tls tests

* fix wrong log message parameter

* fix wrong log message

* add contact-info to smtp tls report, fix wrong fieldnames

* fix wrong fieldnames

* fix wrong index name for search

* at least for some reporting organizations the field sending-mta-ip is optional...

* add missing fields to elasticsearch for smtp tls

* failure_details is a list, add more test cases

* fix wrong name in ci.ini
2024-03-04 10:06:47 -05:00
Yuuki Takahashi d512b9f60e fix: handle none value (#468) 2024-02-19 18:53:52 -05:00
Sean Whalen b8088505b1 Add support for SMTP TLS reports (#453) 2024-02-19 18:45:38 -05:00
Nicholas Hairs cb3f82e847 Add additional samples and ensure git does not touch CRLF (#456)
mimecast sample taken from:
https://github.com/domainaware/parsedmarc/issues/429#issuecomment-1873387507
2024-01-02 16:29:06 -05:00
Sean Whalen 89872d78ac Fix testing 2023-06-27 15:43:09 -04:00
Dave Rawks 84a7386726 Handle unexpected xml parsing errors more gracefully (#349)
* updates `parse_aggregate_report_xml` to not raise an unhandled
  exception on parsing errors
* adds an empty xml file to the aggregate test samples
* adds test for coverage
* Resolves #348
2022-09-08 18:23:34 -04:00
Sean Whalen 4fca674064 6.10.0
- Ignore unknown forensic report fields when generating CSVs (Closes issue #148)
- Fix crash on IMAP timeout (PR #164 - closes issue #163)
- Use SMTP port from the config file when sending emails (PR #151)
- Add support for Elasticsearch 7.0 (PR #161 - closes issue #149)
- Remove temporary workaround for DMARC aggregate report records missing a SPF domain fields
2020-05-10 17:44:14 -04:00
Sean Whalen d0bb858e74 6.9.0 2020-02-17 16:24:11 -05:00
Ebrahim Aharpour 4c57181e21 Making dkim_aligned and spf_aligned case insensitive. 2019-12-16 21:32:00 +01:00
michaeldavie d4ec6dee65 Handle invalid XML 2019-11-05 22:13:06 -05:00
michaeldavie 13a2624850 Handle invalid bytes 2019-11-05 21:15:06 -05:00
Sean Whalen 32cfede9ac 6.3.7
Work around some unexpected IMAP responses reported in issue #75
2019-05-02 22:08:16 -04:00
Sean Whalen e588845f23 6.1.0 - Fix aggregate report email parsing regression
Fix aggregate report email parsing regression in 6.0.3 (closes issues #57 and #58)
2019-02-13 10:30:25 -05:00
Sean Whalen 2c8c7f4659 Fix email parsing 2018-10-14 17:58:47 -04:00
Sean Whalen 49387d9033 4.3.0 release 2018-10-12 12:02:55 -04:00
Sean Whalen f45ab94e06 Update test suitw 2018-10-11 19:01:02 -04:00
Sean Whalen 37d40c01ba Still parse if spf is missing from auth_results 2018-10-07 17:54:25 -04:00
Sean Whalen 16a4be2205 4.1.8 - Be more forgiving of weird XML 2018-10-07 12:50:02 -04:00
Sean Whalen ead03b9779 4.1.7 - Remove any invalid XML schema tags before parsing the XML (#18) 2018-10-06 15:29:02 -04:00
Sean Whalen e30a5bb14f 3.6.1 - Parse aggregate reports with missing spf domain 2018-06-29 11:56:47 -04:00
Sean Whalen 1761f12604 Fix crash when parsing report with empty <auth_results></auth_results> 2018-06-20 09:47:50 -04:00
Sean Whalen 6b9e36ed77 First commit 2018-02-05 20:23:07 -05:00