0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-06 01:10:43 +08:00
discourse/lib/email
Nat 3a3d315a85 SECURITY: Prevent any signed AWS SNS TopicARN from being accepted via webhooks [backport 2026.1]
Manual backport of #732 to 2026.1. Conflict in server.en.yml (no qq_mail_smtp line on this branch) resolved.
  GHSA-8f9m-v436-wr3x

---

Any AWS account holder can subscribe their own SNS topic to a Discourse instance's /webhooks/aws and publish bounce notifications that AWS will sign legitimately. The forged bounces are processed against arbitrary user emails, bumping bounce_score and eventually triggering email revocation..

This fix adds a new `aws_sns_topic_arn_allowlist` site setting. Also hardens Jobs::ProcessSnsNotification against three issues:
- Binds bounces to (message_id, to_address) via find_by, so a legitimately-subscribed SNS publisher can no longer bounce arbitrary recipients we didn't send to.
- Skips duplicate notifications (next if email_log.bounced?) — AWS SNS delivers at-least-once.
- Uses update! instead of update_columns so EmailLog's existing before_save normalizes the bounce status code.

Also add a dashboard problem flags self-hosted admins whose SMTP looks like SES but who haven't set the allowlist yet.

https://github.com/discourse/discourse/security/advisories/GHSA-8f9m-v436-wr3x
2026-06-30 16:27:06 +02:00
..
authentication_results.rb DEV: Apply syntax_tree formatting to lib/* 2023-01-09 12:10:19 +00:00
build_email_helper.rb DEV: Apply syntax_tree formatting to lib/* 2023-01-09 12:10:19 +00:00
cleaner.rb FIX: Email::Cleaner must clear the encoding of replaced bodies 2026-01-15 13:05:25 -05:00
message_builder.rb UX: add preview to email templates (#36657) 2026-01-08 11:33:53 +04:00
message_id_service.rb DEV: Remove old TODOs for message-id formats (#27196) 2024-05-28 13:57:09 +10:00
poller.rb FEATURE: Add hooks for email poller plugins (#21384) 2023-06-26 13:16:03 +08:00
processor.rb FIX: Prevent Email Processor errors when mail is blank or nil (#21292) 2023-05-18 10:39:37 +08:00
receiver.rb DEV: Remove IMAP support in Discourse (#37002) 2026-01-12 10:07:26 +10:00
renderer.rb UX: add preview to email templates (#36657) 2026-01-08 11:33:53 +04:00
sender.rb FIX: Extract readable string from Net::SMTP::Response in error logs 2026-01-07 14:33:07 +00:00
sns.rb SECURITY: Prevent any signed AWS SNS TopicARN from being accepted via webhooks [backport 2026.1] 2026-06-30 16:27:06 +02:00
styles.rb UX: add preview to email templates (#36657) 2026-01-08 11:33:53 +04:00
validator.rb DEV: Apply syntax_tree formatting to lib/* 2023-01-09 12:10:19 +00:00