mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-10 04:36:43 +00:00
feat(GODT-3185): report cases which leads to wrong address key used
This commit is contained in:
@ -205,3 +205,30 @@ func (s *scenario) theBodyInTheResponseToIs(method, path string, value *godog.Do
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *scenario) theMessageUsedKeyForSending(address string) error {
|
||||
addrID := s.t.getUserByAddress(address).getAddrID(address)
|
||||
|
||||
call, err := s.t.getLastCallExcludingHTTPOverride("POST", "/mail/v4/messages")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var body, want map[string]any
|
||||
|
||||
if err := json.Unmarshal(call.ResponseBody, &body); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
want = map[string]any{
|
||||
"Message": map[string]any{
|
||||
"AddressID": addrID,
|
||||
},
|
||||
}
|
||||
|
||||
if !IsSub(body, want) {
|
||||
return fmt.Errorf("have body %v, want %v", body, want)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
42
tests/features/imap/addressmode.feature
Normal file
42
tests/features/imap/addressmode.feature
Normal file
@ -0,0 +1,42 @@
|
||||
Feature: IMAP client authentication with address modes
|
||||
Background:
|
||||
Given there exists an account with username "[user:user]" and password "password"
|
||||
And the account "[user:user]" has additional address "[alias:alias]@[domain]"
|
||||
And it succeeds
|
||||
|
||||
Scenario: IMAP client can authenticate successfully with secondary address in combine mode
|
||||
Given bridge starts
|
||||
And the user logs in with username "[user:user]" and password "password"
|
||||
And user "[user:user]" finishes syncing
|
||||
Then user "[user:user]" connects and authenticates IMAP client "1" with address "[alias:alias]@[domain]"
|
||||
|
||||
Scenario: IMAP client can authenticate successfully with secondary address in split mode
|
||||
Given bridge starts
|
||||
And the user logs in with username "[user:user]" and password "password"
|
||||
And the user sets the address mode of user "[user:user]" to "split"
|
||||
And user "[user:user]" finishes syncing
|
||||
Then user "[user:user]" connects and authenticates IMAP client "1" with address "[alias:alias]@[domain]"
|
||||
|
||||
# Need to find way to setup disabled address on black
|
||||
@skip-black
|
||||
Scenario: IMAP client cannot authenticate successfully with disabled alias in combine mode
|
||||
Given the account "[user:user]" has additional disabled address "[alias:disabled]@[domain]"
|
||||
And it succeeds
|
||||
Given bridge starts
|
||||
And the user logs in with username "[user:user]" and password "password"
|
||||
And user "[user:user]" finishes syncing
|
||||
# GODT-3307 it should succeed
|
||||
When user "[user:user]" connects and can not authenticate IMAP client "1" with address "[alias:disabled]@[domain]"
|
||||
|
||||
# Need to find way to setup disabled address on black
|
||||
@skip-black
|
||||
Scenario: IMAP client cannot authenticate successfully with disabled alias in split mode
|
||||
Given the account "[user:user]" has additional disabled address "[alias:disabled]@[domain]"
|
||||
And it succeeds
|
||||
Given bridge starts
|
||||
And the user logs in with username "[user:user]" and password "password"
|
||||
And the user sets the address mode of user "[user:user]" to "split"
|
||||
And user "[user:user]" finishes syncing
|
||||
# GODT-3307 it should succeed
|
||||
When user "[user:user]" connects and can not authenticate IMAP client "1" with address "[alias:disabled]@[domain]"
|
||||
|
||||
@ -20,13 +20,6 @@ Feature: A user can authenticate an IMAP client
|
||||
Scenario: IMAP client can authenticate successfully with secondary address
|
||||
Given user "[user:user]" connects and authenticates IMAP client "1" with address "[alias:alias]@[domain]"
|
||||
|
||||
# Need to find way to setup disabled address on black
|
||||
@skip-black
|
||||
Scenario: IMAP client can not authenticate successfully with disable address
|
||||
Given the account "[user:user2]" has additional disabled address "[alias:disabled]@[domain]"
|
||||
And it succeeds
|
||||
Then user "[user:user2]" connects and can not authenticate IMAP client "1" with address "[alias:disabled]@[domain]"
|
||||
|
||||
Scenario: IMAP client can authenticate successfully
|
||||
When user "[user:user]" connects IMAP client "1"
|
||||
Then IMAP client "1" can authenticate
|
||||
|
||||
@ -57,6 +57,7 @@ Feature: IMAP create messages
|
||||
And IMAP client "1" eventually sees the following messages in "All Mail":
|
||||
| from | to | subject | body |
|
||||
| [alias:alias]@[domain] | john.doe@email.com | foo | bar |
|
||||
And bridge reports a message with "GODT-3185: import with non-default address in split mode: using sender address"
|
||||
|
||||
Scenario: Imports an unrelated message to inbox
|
||||
When IMAP client "1" appends the following messages to "INBOX":
|
||||
|
||||
@ -164,6 +164,7 @@ Feature: IMAP Draft messages
|
||||
And IMAP client "1" eventually sees the following messages in "Drafts":
|
||||
| to | subject | body |
|
||||
| someone@example.com | Draft without From | This is a Draft without From in header |
|
||||
And bridge reports a message with "GODT-3185: draft with non-default invalid address in split mode: error import/draft"
|
||||
|
||||
@regression
|
||||
Scenario: Only one draft in Drafts and All Mail after editing it locally multiple times
|
||||
|
||||
45
tests/features/smtp/addressmode.feature
Normal file
45
tests/features/smtp/addressmode.feature
Normal file
@ -0,0 +1,45 @@
|
||||
Feature: SMTP client authentication with address modes
|
||||
Background:
|
||||
Given there exists an account with username "[user:user]" and password "password"
|
||||
And the account "[user:user]" has additional address "[alias:alias]@[domain]"
|
||||
And it succeeds
|
||||
|
||||
Scenario: SMTP client can authenticate successfully with secondary address in combine mode
|
||||
Given bridge starts
|
||||
And the user logs in with username "[user:user]" and password "password"
|
||||
And user "[user:user]" finishes syncing
|
||||
When user "[user:user]" connects and authenticates SMTP client "1" with address "[alias:alias]@[domain]"
|
||||
Then it succeeds
|
||||
|
||||
Scenario: SMTP client can authenticate successfully with secondary address in split mode
|
||||
Given bridge starts
|
||||
And the user logs in with username "[user:user]" and password "password"
|
||||
And the user sets the address mode of user "[user:user]" to "split"
|
||||
And user "[user:user]" finishes syncing
|
||||
When user "[user:user]" connects and authenticates SMTP client "1" with address "[alias:alias]@[domain]"
|
||||
Then it succeeds
|
||||
|
||||
# Need to find way to setup disabled address on black
|
||||
@skip-black
|
||||
Scenario: SMTP client can authenticate successfully with disabled alias in combine mode
|
||||
Given the account "[user:user]" has additional disabled address "[alias:disabled]@[domain]"
|
||||
And it succeeds
|
||||
Given bridge starts
|
||||
And the user logs in with username "[user:user]" and password "password"
|
||||
And user "[user:user]" finishes syncing
|
||||
When user "[user:user]" connects and authenticates SMTP client "1" with address "[alias:disabled]@[domain]"
|
||||
Then it fails
|
||||
|
||||
# Need to find way to setup disabled address on black
|
||||
@skip-black
|
||||
Scenario: SMTP client can authenticate successfully with disabled alias in split mode
|
||||
Given the account "[user:user]" has additional disabled address "[alias:disabled]@[domain]"
|
||||
And it succeeds
|
||||
Given bridge starts
|
||||
And the user logs in with username "[user:user]" and password "password"
|
||||
And the user sets the address mode of user "[user:user]" to "split"
|
||||
And user "[user:user]" finishes syncing
|
||||
When user "[user:user]" connects and authenticates SMTP client "1" with address "[alias:disabled]@[domain]"
|
||||
Then it fails
|
||||
|
||||
|
||||
@ -20,5 +20,5 @@ Feature: SMTP wrong messages
|
||||
|
||||
Hello
|
||||
"""
|
||||
And it fails with error "Error: can't send on address: [user:disabled]@[domain]"
|
||||
And it fails with error "Error: cannot send from address: [user:disabled]@[domain]"
|
||||
|
||||
|
||||
@ -331,4 +331,4 @@ Feature: SMTP sending of plain messages
|
||||
}
|
||||
]
|
||||
}
|
||||
"""
|
||||
"""
|
||||
|
||||
79
tests/features/smtp/send/sender_key.feature
Normal file
79
tests/features/smtp/send/sender_key.feature
Normal file
@ -0,0 +1,79 @@
|
||||
Feature: Address key usage during SMTP send
|
||||
Background:
|
||||
Given there exists an account with username "[user:user]" and password "password"
|
||||
And the account "[user:user]" has additional address "[alias:alias]@[domain]"
|
||||
And it succeeds
|
||||
|
||||
Scenario: Non-active sender in combined mode using non-active key
|
||||
Given bridge starts
|
||||
And the user logs in with username "[user:user]" and password "password"
|
||||
And it succeeds
|
||||
When user "[user:user]" connects and authenticates SMTP client "1" with address "[user:user]@[domain]"
|
||||
And SMTP client "1" sends the following message from "[alias:alias]@[domain]" to "pm.bridge.qa@gmail.com":
|
||||
"""
|
||||
From: Bridge Test <[alias:alias]@[domain]>
|
||||
To: External Bridge <pm.bridge.qa@gmail.com>
|
||||
|
||||
hello
|
||||
|
||||
"""
|
||||
Then it succeeds
|
||||
And the message used "[alias:alias]@[domain]" key for sending
|
||||
|
||||
Scenario: Non-active sender in split mode using non-active key
|
||||
Given bridge starts
|
||||
And the user logs in with username "[user:user]" and password "password"
|
||||
And the user sets the address mode of user "[user:user]" to "split"
|
||||
And user "[user:user]" finishes syncing
|
||||
And it succeeds
|
||||
When user "[user:user]" connects and authenticates SMTP client "1" with address "[user:user]@[domain]"
|
||||
And SMTP client "1" sends the following message from "[alias:alias]@[domain]" to "pm.bridge.qa@gmail.com":
|
||||
"""
|
||||
From: Bridge Test <[alias:alias]@[domain]>
|
||||
To: External Bridge <pm.bridge.qa@gmail.com>
|
||||
|
||||
hello
|
||||
|
||||
"""
|
||||
Then it succeeds
|
||||
And the message used "[alias:alias]@[domain]" key for sending
|
||||
|
||||
# Need to find way to setup disabled address on black
|
||||
@skip-black
|
||||
Scenario: Disabled sender in combined mode fails to send
|
||||
Given the account "[user:user]" has additional disabled address "[user:disabled]@[domain]"
|
||||
And it succeeds
|
||||
And bridge starts
|
||||
And the user logs in with username "[user:user]" and password "password"
|
||||
And it succeeds
|
||||
When user "[user:user]" connects and authenticates SMTP client "1" with address "[user:user]@[domain]"
|
||||
And SMTP client "1" sends the following message from "[alias:disabled]@[domain]" to "pm.bridge.qa@gmail.com":
|
||||
"""
|
||||
From: Bridge Test <[alias:disabled]@[domain]>
|
||||
To: External Bridge <pm.bridge.qa@gmail.com>
|
||||
|
||||
hello
|
||||
|
||||
"""
|
||||
Then it fails
|
||||
|
||||
# Need to find way to setup disabled address on black
|
||||
@skip-black
|
||||
Scenario: Disabled sender in split mode fails to send
|
||||
Given the account "[user:user]" has additional disabled address "[alias:disabled]@[domain]"
|
||||
And it succeeds
|
||||
And bridge starts
|
||||
And the user logs in with username "[user:user]" and password "password"
|
||||
And the user sets the address mode of user "[user:user]" to "split"
|
||||
And user "[user:user]" finishes syncing
|
||||
And it succeeds
|
||||
When user "[user:user]" connects and authenticates SMTP client "1" with address "[alias:alias]@[domain]"
|
||||
And SMTP client "1" sends the following message from "[alias:disabled]@[domain]" to "pm.bridge.qa@gmail.com":
|
||||
"""
|
||||
From: Bridge Test <[alias:disabled]@[domain]>
|
||||
To: External Bridge <pm.bridge.qa@gmail.com>
|
||||
|
||||
hello
|
||||
|
||||
"""
|
||||
Then it fails
|
||||
@ -38,6 +38,8 @@ func (s *scenario) steps(ctx *godog.ScenarioContext) {
|
||||
ctx.Step(`^the network port range (\d+)-(\d+) is busy$`, s.networkPortRangeIsBusy)
|
||||
ctx.Step(`^bridge IMAP port is (\d+)`, s.bridgeIMAPPortIs)
|
||||
ctx.Step(`^bridge SMTP port is (\d+)`, s.bridgeSMTPPortIs)
|
||||
ctx.Step(`^the message used "([^"]*)" key for sending$`, s.theMessageUsedKeyForSending)
|
||||
|
||||
// ==== SETUP ====
|
||||
ctx.Step(`^there exists an account with username "([^"]*)" and password "([^"]*)"$`, s.thereExistsAnAccountWithUsernameAndPassword)
|
||||
ctx.Step(`^there exists a disabled account with username "([^"]*)" and password "([^"]*)"$`, s.thereExistsAnAccountWithUsernameAndPasswordWithDisablePrimary)
|
||||
|
||||
Reference in New Issue
Block a user