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

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

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.

Summary ID
Handle parsing DMARC records that consists of individual-quoted fields.
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 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.
fbd38dcfb9b3e9c65dba338532cff0ea3cffaad4
Description From Last Updated

Typo in description: recod -> record

maubinmaubin

later -> latter

daviddavid
david
  1. 
      
  2. djblets/mail/dmarc.py (Diff revision 1)
     
     
    Show all issues

    later -> latter

  3. 
      
maubin
  1. 
      
  2. Show all issues

    Typo in description: recod -> record

  3. 
      
chipx86
david
  1. Ship It!
  2. 
      
maubin
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-5.x (ecec8e2)