summaryrefslogtreecommitdiffstats
path: root/services/mailer/mail_repo.go
diff options
context:
space:
mode:
authorKN4CK3R <admin@oldschoolhack.me>2023-01-22 15:23:52 +0100
committerGitHub <noreply@github.com>2023-01-22 08:23:52 -0600
commit21dd4a252a98fee4e8b4304d63685c4fae7cc077 (patch)
tree20e81cfe513753adc19c5a1902289d6925cb3aa2 /services/mailer/mail_repo.go
parent6737e1c5d589e9521e4e07824a2fc9280270e19f (diff)
downloadgitea-21dd4a252a98fee4e8b4304d63685c4fae7cc077.tar.gz
gitea-21dd4a252a98fee4e8b4304d63685c4fae7cc077.zip
Prevent multiple `To` recipients (#22566)
Change the mailer interface to prevent leaking of possible hidden email addresses when sending to multiple recipients. Co-authored-by: Gusted <williamzijl7@hotmail.com>
Diffstat (limited to 'services/mailer/mail_repo.go')
-rw-r--r--services/mailer/mail_repo.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/services/mailer/mail_repo.go b/services/mailer/mail_repo.go
index 5fa13f5044..9b2f24faa8 100644
--- a/services/mailer/mail_repo.go
+++ b/services/mailer/mail_repo.go
@@ -82,9 +82,12 @@ func sendRepoTransferNotifyMailPerLang(lang string, newOwner, doer *user_model.U
return err
}
- msg := NewMessage(emails, subject, content.String())
- msg.Info = fmt.Sprintf("UID: %d, repository pending transfer notification", newOwner.ID)
+ for _, to := range emails {
+ msg := NewMessage(to, subject, content.String())
+ msg.Info = fmt.Sprintf("UID: %d, repository pending transfer notification", newOwner.ID)
+
+ SendAsync(msg)
+ }
- SendAsync(msg)
return nil
}