Add DMARCbis aggregate/failure report support; rename forensic→failure project-wide#659
Add DMARCbis aggregate/failure report support; rename forensic→failure project-wide#659
Conversation
|
@copilot Let's make to dashboard queries backwards compatible so they show data before and after the forensic to failure rename, |
Updated all dashboard queries to be backward compatible in
|
|
@copilot fix the ruff check F401 |
Fixed in |
|
@copilot Let's make pct and fo None on DMARCbis reports, where they are not used/provided. |
Done in |
|
@copilot will that cause problems with Elasticsearch/OpenSearch document mappings and saving documents? |
No, it won't cause problems. In the ES/OS |
There was a problem hiding this comment.
Pull request overview
This PR adds support for DMARCbis aggregate/failure reports and renames "forensic" to "failure" throughout the codebase, aligning with RFC terminology.
Changes:
- Adds DMARCbis fields:
np,testing,discovery_method,generator,human_result - Renames all "forensic" references to "failure" with backward-compatible aliases
- Updates dashboards, documentation, and sample files
Reviewed changes
Copilot reviewed 27 out of 28 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests.py | Added DMARCbis tests and backward compatibility tests |
| parsedmarc/types.py | Added new field types and renamed FailureReport with alias |
| parsedmarc/init.py | Core parsing logic for DMARCbis fields and renaming |
| parsedmarc/elastic.py, opensearch.py | Index mappings for new fields, renamed functions |
| parsedmarc/splunk.py, webhook.py, etc. | Renamed methods with backward-compatible aliases |
| splunk/, kibana/, grafana/ | Dashboard updates with backward-compatible queries |
| samples/aggregate/*.xml | New DMARCbis sample reports |
| docs/ | Documentation terminology updates |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@copilot Can you also add tests to cover all code that is not already covered by tests? |
Added 89 new tests (104 total, all passing) covering core parsing functions ( |
|
@copilot revise AGENTS.md to properly reflect the changes in this PR. |
Updated in
|
|
Done in
All 113 tests pass and ruff is clean. |
|
@copilot Fix ruff formatting errors |
Fixed in
All 146 tests pass, |
|
@copilot Why are the tests failing after my most recent merge. I want to keep the quality of the upstream tests. |
Fixed in |
|
@copilot What did I break in the most recent merge? |
The merge brought in one new upstream test ( Fixed in |
54f72e8 to
73f4e90
Compare
5f4d86d to
d7366d0
Compare
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. 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 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. 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>
d7366d0 to
576c68e
Compare
Summary
DMARCbis aggregate fields
New fields from the XSD schema added to types, parsing, validation, CSV output, and Elasticsearch/OpenSearch mappings:
np— non-existent subdomain policy (none/quarantine/reject)testing— testing mode flag (n/y), replaces RFC 7489pctdiscovery_method— policy discovery method (psl/treewalk)generator— report generator software identifier (metadata)human_result— optional descriptive text on DKIM/SPF auth resultsField values are validated against XSD enumerations.
passis now a valid disposition value per DMARCbisActionDispositionType.pctandfodefault toNonewhen absent (DMARCbis drops these). Namespaced XML without<?xmldeclaration is handled correctly.Forensic → failure rename
All references renamed project-wide:
types.py,__init__.py—ForensicReport→FailureReport,parse_forensic_report→parse_failure_reportelastic.py,opensearch.py,splunk.py,kafkaclient.py,syslog.py,gelf.py,webhook.py,loganalytics.py,s3.pycli.py— args, config keys, index names (dmarc_failure)samples/forensic/→samples/failure/Why
Testing
extract_report.ruff checkandruff format --checkboth pass clean.Backward Compatibility / Risk
parse_forensic_report = parse_failure_report,ForensicReport = FailureReport, etc.)save_forensic,forensic_topic) and new keys (save_failure,failure_topic)dmarc_f*matches bothdmarc_forensic*anddmarc_failure*(sourcetype="dmarc:failure" OR sourcetype="dmarc:forensic")dmarc_failure*anddmarc_forensic*index patternsNonefor DMARCbis-only fields;pct/foareNonewhen absent (ES/OS omitNonefields gracefully)Related Issue
Checklist
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.