-
-
Notifications
You must be signed in to change notification settings - Fork 103
feat: protect the Date header #6877
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Legacy Python test Lines 603 to 610 in adcc8a9
|
caf6eff
to
29d1d87
Compare
This has now broken the test added in c14f45a |
29d1d87
to
e533c2c
Compare
e533c2c
to
5663fff
Compare
68a4d43
to
154272e
Compare
7a65541
to
89df953
Compare
154272e
to
10f3e09
Compare
We will have to use something less suspicious than unix epoch, GMX is unhappy: |
d06a61e
to
ebb7ce8
Compare
I have updated this PR to not send 1970 as the date. Should be good enough for review/merging now. |
So now the date looks like this
|
We do not try to delete resent messages anymore. Previously resent messages were distinguised by having duplicate Message-ID, but future Date, but now we need to download the message before we even see the Date. We now move the message to the destination folder but do not fetch it. It may not be a good idea to delete the duplicate in multi-device setups anyway, because the device which has a message may delete the duplicate of a message the other device missed. To avoid triggering IMAP move loop described in the comments we now only move the messages from INBOX and Spam folders.
ebb7ce8
to
54dce24
Compare
@@ -162,25 +162,18 @@ pub(crate) async fn download_msg( | |||
|row| { | |||
let server_uid: u32 = row.get(0)?; | |||
let server_folder: String = row.get(1)?; | |||
let uidvalidity: u32 = row.get(2)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not looking at uidvalidity anymore? Moreover, it's still SELECT
ed above
@@ -581,52 +581,26 @@ impl Imap { | |||
|
|||
// Determine the target folder where the message should be moved to. | |||
// | |||
// If we have seen the message on the IMAP server before, do not move it. | |||
// We only move the messages from the INBOX folder. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... and Spam folders.
// | ||
// and the explanation page says | ||
// "The time information deviates too much from the actual time". | ||
let coarse_grained_timestamp = self.timestamp - (self.timestamp % 1000000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's just ~11.6 days, can't it be longer, say, several months? Secondly, this actually leaks the date when the remainder is 0 or close to it and the message reaches the server immediately or quickly. It'd be better to introduce a Config
key with the currently used fake date and advance it randomly when it's too old. We have the config cache, so it will be cheap.
@@ -253,27 +239,8 @@ pub(crate) async fn receive_imf_inner( | |||
} else { | |||
replace_msg_id = if rfc724_mid_orig == rfc724_mid { | |||
None | |||
} else if let Some((old_msg_id, old_ts_sent)) = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part looks unrelated because looking at encrypted timestamp_sent
is fine, and does this mean that duplicates will be never deleted, even if the message is deleted by the user?
Closes #6878
Based on #6867
This depends an a fix #6669, so we may want to postpone merging this until more users have it.
We do not try to delete resent messages
anymore. Previously resent messages
were distinguised by having duplicate Message-ID,
but future Date, but now we need to download
the message before we even see the Date.
We now move the message to the destination folder
but do not fetch it.
It may not be a good idea to delete
the duplicate in multi-device setups anyway,
because the device which has a message
may delete the duplicate of a message
the other device missed.
To avoid triggering IMAP move loop
described in the comments
we now only move the messages
from INBOX and Spam folders.