Skip to content

fix(app): Ignore SCOTUS/Texas emails from other SES rules#35

Merged
albertisfu merged 4 commits into
mainfrom
morgan/34-routing
May 27, 2026
Merged

fix(app): Ignore SCOTUS/Texas emails from other SES rules#35
albertisfu merged 4 commits into
mainfrom
morgan/34-routing

Conversation

@MorganBennetDev

Copy link
Copy Markdown
Contributor

Verify that the destination subscription subdomain matches the source court domain before routing. Emails from sc-us.gov or txcourts.gov must be sent to a @scotus.recap.email or @texas.recap.email address respectively or they will be ignored.

Closes #34

Verify that the destination subscription subdomain matches the source
court domain before routing. Emails from sc-us.gov or txcourts.gov
arriving via the generic recap.email SES rule are now ignored to avoid
double processing and race conditions.

Closes #34

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

@albertisfu albertisfu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @MorganBennetDev this looks great I just have a small suggestion, please.

Comment thread cl/recap_email/app/app.py Outdated
Comment on lines +162 to +171
for destination in email.get("destination", []):
dest_parts = parseaddr(destination)[1].split("@")
if len(dest_parts) != 2:
return False
dest_domain = dest_parts[1].lower()
if dest_domain != required and not dest_domain.endswith(
f".{required}"
):
return False
return True

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be weird, but if someday PACER, TAMES, or SCOTUS sends messages with more than one destination by mistake, like ['notifications@scotus.recap.email', 'no_reply@sc-us.gov'], the message will be dropped even though it was properly sent to our email address, because the second address would make this fail.

I think we can invert the logic to be more cautious so that we return True for any match and False only if there’s no match at all.

@albertisfu albertisfu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @MorganBennetDev this looks great I just have a small suggestion, please.

@albertisfu albertisfu moved this from In progress to To Do in Sprint (Web Team) May 27, 2026

@albertisfu albertisfu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @MorganBennetDev this looks great.

I'll be deploying this changed to the lambda.

@albertisfu albertisfu merged commit 952b1aa into main May 27, 2026
4 checks passed
@albertisfu albertisfu deleted the morgan/34-routing branch May 27, 2026 21:56
@github-project-automation github-project-automation Bot moved this from To Do to Done in Sprint (Web Team) May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Only route SCOTUS and Texas emails if they come from scotus.recap.email and texas.recap.email subscriptions.

2 participants