Handle parsing DMARC records that consists of individual-quoted fields.
Review Request #14110 — Created Aug. 19, 2024 and submitted
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
fromdmarc-record-<host>
todmarc-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.
- Change Summary:
-
Fixed typos.
- Description:
-
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 recod in the ~ 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 insteadwe 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>
todmarc-record:<host>
. This willinvalidate all old records and force a re-fetch and parse of any DMARC records. - Commits:
-
Summary ID 509a27027982ca48b206b48138614b17bbb0e2f8 fbd38dcfb9b3e9c65dba338532cff0ea3cffaad4