mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-10 04:36:43 +00:00
fix(GODT-3132): Do not allow sending on disabled accounts
This commit is contained in:
@ -102,7 +102,7 @@ func (s *Service) smtpSendMail(ctx context.Context, authID string, from string,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !fromAddr.Send {
|
if !fromAddr.Send || fromAddr.Status != proton.AddressStatusEnabled {
|
||||||
s.log.Errorf("Can't send emails on address: %v", fromAddr.Email)
|
s.log.Errorf("Can't send emails on address: %v", fromAddr.Email)
|
||||||
return &ErrCanNotSendOnAddress{address: fromAddr.Email}
|
return &ErrCanNotSendOnAddress{address: fromAddr.Email}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
Feature: SMTP wrong messages
|
Feature: SMTP wrong messages
|
||||||
Background:
|
Background:
|
||||||
Given there exists an account with username "[user:user]" and password "password"
|
Given there exists an account with username "[user:user]" and password "password"
|
||||||
|
And the account "[user:user]" has additional disabled address "[user:disabled]@[domain]"
|
||||||
And there exists an account with username "[user:to]" and password "password"
|
And there exists an account with username "[user:to]" and password "password"
|
||||||
Then it succeeds
|
Then it succeeds
|
||||||
When bridge starts
|
When bridge starts
|
||||||
@ -54,4 +55,14 @@ Feature: SMTP wrong messages
|
|||||||
hello
|
hello
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Then it fails
|
Then it fails with error "invalid return path"
|
||||||
|
|
||||||
|
Scenario: Send from a valid address that cannot send
|
||||||
|
When SMTP client "1" sends the following message from "[user:disabled]@[domain]" to "[user:to]@[domain]":
|
||||||
|
"""
|
||||||
|
From: Bridge Test Disabled <[user:disabled]@[domain]>
|
||||||
|
To: Internal Bridge <[user:to]@[domain]>
|
||||||
|
|
||||||
|
Hello
|
||||||
|
"""
|
||||||
|
And it fails with error "Error: can't send on address: [user:disabled]@[domain]"
|
||||||
|
|||||||
Reference in New Issue
Block a user