procurement-ingest/tests
Adam Moussa 25b7fc188d
Fix quoted-AUID DKIM domain spoof in sender auth
Resolve three confirmed /sh-security-review findings on the fail-closed
SES sender-authentication control.

HIGH: header.i/header.d domain extraction was not quoted-string aware.
An attacker with a valid DKIM key for their own domain could set an
RFC 6376-legal AUID such as i="@seahaven.com"@attacker.com; the naive
extractor stopped at the closing quote and returned seahaven.com,
accepting forged mail. Extraction now tokenises the clause with the same
quoted-string discipline already used for clause splitting: header.d
(the plain signing domain) is authoritative when present, otherwise the
header.i domain is the part after the AUID's LAST top-level "@", so a "@"
inside a quoted local-part is treated as signer-controlled label text and
yields the true signer (attacker.com), not seahaven.com.

LOW: the topmost-header parse ran outside evaluate_sender_authentication's
try/except, so an unexpected parser exception on crafted input could
propagate into the handler and Lambda async retries/DLQ. The parse now
fails CLOSED with an authentication_results_unparseable reason.

MEDIUM: the sender_auth_rejected alarm used Sum>=3 over 15 min, blind to
a low-volume total-reject outage (a trickle that never sums to 3). Both
stacks now alarm on >=1 reject per 5-min period with evaluation_periods=3
/ datapoints_to_alarm=2, so a sustained reject condition pages even at one
reject per period while a lone stray probe self-clears.

Refs: INFRA-107
2026-07-15 20:24:07 -04:00
..
conftest.py Add fail-closed SES sender authentication 2026-07-15 20:24:07 -04:00
requirements.txt Land safe fixes from 2026-06-17 security sweep (#97) 2026-07-15 20:17:46 -04:00
test_pad_zip.py Add pytest suite and enable tests in CI (#95) 2026-07-15 19:06:20 -04:00
test_parse_raw_email.py Add pytest suite and enable tests in CI (#95) 2026-07-15 19:06:20 -04:00
test_po_merge.py Land safe fixes from 2026-06-17 security sweep (#97) 2026-07-15 20:17:46 -04:00
test_ses_auth.py Fix quoted-AUID DKIM domain spoof in sender auth 2026-07-15 20:24:07 -04:00