fix(SEC): Signup-Enumeration durch Always-Send-Email schließen
Bei doppeltem Signup wird eine "bereits registriert"-Mail gesendet, sodass jeder Signup-Versuch eine ausgehende E-Mail erzeugt. Side-Channel-Angriff zur Account-Enumeration nicht mehr möglich. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -55,10 +55,20 @@ func (s *Server) handleSignup(w http.ResponseWriter, r *http.Request) {
|
||||
req.TenantID = tok.TenantID
|
||||
}
|
||||
|
||||
const signupMsg = "Wenn die E-Mail-Adresse verfügbar ist, wurde eine Bestätigungs-E-Mail gesendet."
|
||||
|
||||
u, err := s.users.CreateInactive(req)
|
||||
if err != nil {
|
||||
// Avoid info-leakage: same response for duplicate email/username
|
||||
writeJSON(w, http.StatusOK, map[string]string{"message": "Wenn die E-Mail-Adresse verfügbar ist, wurde eine Bestätigungs-E-Mail gesendet."})
|
||||
// SEC: Send "already registered" email to prevent account enumeration via
|
||||
// email delivery side-channel. Every signup attempt produces an outgoing email.
|
||||
if s.mailer.IsConfigured() {
|
||||
go func() {
|
||||
html := mailer.AlreadyRegisteredHTML(s.fqdn)
|
||||
txt := mailer.AlreadyRegisteredText(s.fqdn)
|
||||
_ = s.mailer.Send(body.Email, "archivmail – Registrierungsversuch", html, txt)
|
||||
}()
|
||||
}
|
||||
writeJSON(w, http.StatusOK, map[string]string{"message": signupMsg})
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user