Skip to content

Bug: SesModel drops dkimVerdict and dmarcPolicy from the receipt #8880

Open

Description

@mayank145

Expected Behaviour

SES includes the DKIM result (receipt.dkimVerdict) in inbound email events, and receipt.dmarcPolicy when the sending domain's DMARC check fails (SES notification contents). AWS's own Lambda example drops spam by checking receipt.dkimVerdict.status. SesModel should keep both fields, so a handler can filter on the DKIM result the same way it can on spfVerdict and dmarcVerdict. The TypeScript parser's SES schema already includes dkimVerdict and dmarcPolicy.

Current Behaviour

SesReceipt in aws_lambda_powertools/utilities/parser/models/ses.py declares spamVerdict, virusVerdict, spfVerdict and dmarcVerdict, but not dkimVerdict or dmarcPolicy, so both are dropped during parsing. The repo's tests/events/sesEvent.json has both fields, and neither survives parsing:

{'status': 'PASS'} reject
['action', 'dmarcVerdict', 'processingTimeMillis', 'recipients', 'spamVerdict', 'spfVerdict', 'timestamp', 'virusVerdict']

The SESEvent data class already exposes them as dkim_verdict and dmarc_policy.

Code snippet

import json

from aws_lambda_powertools.utilities.parser import parse
from aws_lambda_powertools.utilities.parser.models import SesModel

with open("tests/events/sesEvent.json") as f:
    event = json.load(f)

receipt = event["Records"][0]["ses"]["receipt"]
print(receipt["dkimVerdict"], receipt["dmarcPolicy"])

parsed = parse(event=event, model=SesModel)
print(sorted(parsed.Records[0].ses.receipt.model_dump().keys()))

Possible Solution

Add two optional fields to SesReceipt:

  • dkimVerdict: SesReceiptVerdict | None = None
  • dmarcPolicy: Literal["none", "quarantine", "reject"] | None = None

Both are optional, so events without them parse the same as today and nothing that parses now starts failing. With that change, the snippet's second line includes dkimVerdict and dmarcPolicy.

I can send a PR with a test that fails on develop.

Steps to Reproduce

Run the snippet above from the repo root on develop.

Did you run the reproduction yourself?

Yes, I ran it and saw the failure

Powertools for AWS Lambda (Python) version

latest

AWS Lambda function runtime

3.12

Packaging format used

PyPi

Debugging logs

Activity

  1. added
    bug
    triage
    on Nov 21, 2026
  2. boring-cyborg commented on Nov 21, 2026

    @boring-cyborg

    Thanks for opening your first issue here! We'll come back to you as soon as we can.
    In the meantime, check out the #python channel on our Powertools for AWS Lambda Discord: Invite link

  3. powertools-for-aws-oss-automation commented on Nov 21, 2026

    @powertools-for-aws-oss-automation

    Thanks for opening your first issue here! We'll come back to you as soon as we can.
    In the meantime, check out our GitHub Discussions: Join the conversation

  4. mayank145 commented on Nov 23, 2026

    @mayank145
    Author

    Hi @leandrodamascena, I reported this issue and noted I'd send a fix. I pushed it to my fork shortly after filing (mayank145@8ce2be7): the same two optional fields, a test that fails on develop, and a test for events without the fields, verified with the parser test suite, make lint and make mypy. I held off on opening the PR while the issue was pending triage, as AGENTS.md asks.

    I see #8882 was opened in the meantime. I'm happy to open my PR or to step aside, whichever you prefer. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugtriage

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions