Handle parsing DMARC records that consists of individual-quoted fields.

Review Request #14110 — Created Aug. 19, 2024 and submitted — Latest diff uploaded

Information

Djblets
release-5.x

Reviewers

Our DMARC record parser made the assumption that the entire DMARC record
was quoted in a single string. This is the usual way DMARC records are
composed. However, a case came up where a customer had a record in the
form of:

"v=DMARC1;" "p=reject;" "pct=100;"

Our parser couldn't handle this. The p key was not found, and instead
we had a " "p key.

This was due to us grabbing the entire text record, rather than the
individual strings in the record. We now grab those strings instead and
join them together, giving us a nice, normalized text string we can work
with.

To avoid issues with legacy cached data, the cache key has been renamed
from dmarc-record-<host> to dmarc-record:<host>. This will
invalidate all old records and force a re-fetch and parse of any DMARC
records.

Unit tests pass.

Tested this against a known DMARC record that we failed to parse.
Verified the results were correct.

Commits

Files