Skip to content

fix(iac/aws): scope Fargate SES send to email_from_domain (match Lambda role, adversarial-review) - #1449

Merged
cristim merged 1 commit into
mainfrom
fix/fargate-ses-fromaddress-scope
Jul 17, 2026
Merged

cristim merged 1 commit into
mainfrom
fix/fargate-ses-fromaddress-scope

Conversation

@cristim

@cristim cristim commented Jul 17, 2026

Copy link
Copy Markdown
Member

Summary

  • Defect confirmed on origin/main: aws_iam_role_policy.ses_access in the Fargate module (Sid SendFromAnyVerifiedIdentity) granted ses:SendEmail and ses:SendRawEmail on Resource = "*" with no Condition, allowing a compromised ECS task to send mail from any SES-verified identity in the account.
  • Fix: split the single statement into two, mirroring the Lambda module's existing pattern exactly:
    • SendFromCUDlyDomain - send actions gated by StringLike { "ses:FromAddress" = "*@${var.email_from_domain}" }
    • SESReadOnly - read-only introspection actions (ses:GetAccount, ses:GetEmailIdentity) without a Condition (no sending capability)
  • var.email_from_domain was already declared in the Fargate module's variables.tf and used in the count guard, so no variable threading was required.

Files changed

  • terraform/modules/compute/aws/fargate/main.tf - updated SES IAM policy and extended the block comment with the full blast-radius rationale (mirrors the Lambda module's comment).

Verification

  • terraform fmt -check clean on the touched module.
  • tflint clean on the touched module.
  • terraform validate not run (provider cache not present in worktree); HCL syntax verified via fmt.

Test plan

  • Deploy Fargate stack in a staging environment with email_from_domain set; confirm email sending still works from the configured domain.
  • Verify a send attempt using a From address outside the configured domain is rejected by SES (IAM condition enforcement).
  • Confirm deployments with email_from_domain = "" still attach zero SES permissions.

Found via adversarial IaC security review of origin/main.

The Fargate task role's SES policy granted ses:SendEmail and
ses:SendRawEmail on Resource="*" with no Condition, so a compromised ECS
task could spoof mail from any SES-verified identity in the account.

Split the single "SendFromAnyVerifiedIdentity" statement into two, to
mirror the Lambda module's existing defence-in-depth pattern:

- "SendFromCUDlyDomain": ses:SendEmail + ses:SendRawEmail on Resource="*"
  gated by StringLike { "ses:FromAddress" = "*@${var.email_from_domain}" }
- "SESReadOnly": ses:GetAccount + ses:GetEmailIdentity on Resource="*"
  (read-only; no send risk; no Condition required)

var.email_from_domain is already declared in the Fargate module's
variables.tf and used in the count guard, so no variable threading is
needed. Deployments with email_from_domain="" still receive zero SES
permissions.

terraform fmt and tflint both pass on the touched module.

Found via adversarial security review of IaC in origin/main.
@cristim cristim added triaged Item has been triaged priority/p2 Backlog-worthy severity/medium Moderate harm urgency/this-sprint Within the current sprint impact/many Affects most users effort/s Hours type/security Security finding labels Jul 17, 2026
@cristim

cristim commented Jul 17, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 29 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1aa829f0-177b-40a1-85cf-6d877a060f36

📥 Commits

Reviewing files that changed from the base of the PR and between 8f9347e and a3d603a.

📒 Files selected for processing (1)
  • terraform/modules/compute/aws/fargate/main.tf
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/fargate-ses-fromaddress-scope

Comment @coderabbitai help to get the list of available commands.

@coderabbitai

coderabbitai Bot commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@cristim
cristim merged commit 79f6c6d into main Jul 17, 2026
19 checks passed
@cristim
cristim deleted the fix/fargate-ses-fromaddress-scope branch July 27, 2026 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/s Hours impact/many Affects most users priority/p2 Backlog-worthy severity/medium Moderate harm triaged Item has been triaged type/security Security finding urgency/this-sprint Within the current sprint

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant