Repository navigation
Description
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 = NonedmarcPolicy: 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
Metadata
Metadata
Assignees
Type
Projects
- StatusShow more project fieldsTriage
Activity
boring-cyborg commentedon Nov 21, 2026
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
powertools-for-aws-oss-automation commentedon Nov 21, 2026
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
mayank145 commentedon Nov 23, 2026
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 lintandmake 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!