Option to prevent local time disclosure in Date header
Categories
(Thunderbird :: Preferences, enhancement)
Tracking
(Not tracked)
People
(Reporter: segfault, Assigned: segfault)
Details
Attachments
(1 file, 5 obsolete files)
|
9.69 KB,
patch
|
mkmelin
:
review+
|
Details | Diff | Splinter Review |
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0
This is about the same feature that was requested in bug 902573, which was closed because the original authors found a way to solve this in the TorBirdy extension. Because TorBirdy is not compatible with current Thunderbird anymore, and the new MailExtensions API doesn't allow extensions to do this kind of modification, Thunderbird should provide an option for that.
This is another patch created by Tails to replace part of the functionality previously provided by TorBirdy, in this case to sanitize the Date header to prevent fingerprinting.
This patch will conflict with the one of bug 1370217, because both add preferences to comm/mailnews/mailnews.js. I can update the other patch once one of them was accepted.
Updated•6 years ago
|
Comment 4•6 years ago
|
||
Could be better to fix this at the caller, but creating a tidied up date there, instead of trying to correct it in the emitting phase.
I now have a patch ready to sanitize the date in nsMsgCompUtils.cpp. But the date string is parsed to a JS date object and converted back to a string in jsmime.js, which means that the timezone information is lost, and the final date string is in the local timezone again. So we do have to strip off the timezone information in jsmime.js or jsmime.jsm - and I don't know how to do that in jsmime.jsm. Should I somehow override the HeaderEmitter.prototype.addDate function there? Could you give me a hint how I can do that?
Comment 6•6 years ago
|
||
Maybe you can rely on this: https://searchfox.org/comm-central/rev/31a8ac5c20c4ed20d064ea5b51c72956d1944235/mailnews/mime/jsmime/jsmime.js#1402,1449-1453 - that is, in nsMsgCompUtils.cpp produce a suitable date string which would set timezone to 0?
Maybe you can rely on this: https://searchfox.org/comm-central/rev/31a8ac5c20c4ed20d064ea5b51c72956d1944235/mailnews/mime/jsmime/jsmime.js#1402,1449-1453 - that is, in nsMsgCompUtils.cpp produce a suitable date string which would set timezone to 0?
Unfortunately, that doesn't work, because in any case the date object is created in the local timezone, and, as stated in the function's comment, JS date objects cannot retain the timezone information: https://searchfox.org/comm-central/rev/31a8ac5c20c4ed20d064ea5b51c72956d1944235/mailnews/mime/jsmime/jsmime.js#1383-1387,1459-1465
Comment 8•6 years ago
|
||
I don't think I understand. If you in cpp create and convert the date string such that it's the UTC time with 00 timezone indicated (or missing). Don't you get the thing you want? The date is created in the local timezone, but the code adjusts for the local timezone, so the "time" would be right no?
Sure, the time would be right, but it does not contain information that it's in UTC (because JS date objects don't store that information). So when that date is finally added to the header, the local timezone is added again: https://searchfox.org/comm-central/rev/31a8ac5c20c4ed20d064ea5b51c72956d1944235/mailnews/mime/jsmime/jsmime.js#3463
The only way I see to change that is by changing the code in the addDate function, which I did in my first patch.
| Assignee | ||
Comment 10•6 years ago
|
||
How about this? I extracted the code which encodes the date object to a string to a new function in jsmime.jsm.
I didn't add a test yet, because I would first like to know if you're ok with that solution.
Comment 11•6 years ago
|
||
Comment 12•6 years ago
|
||
Sorry I don't know what the best approach here would be. Maybe the headers should be just parsed and reprocessed at a later stage if that pref is set.
| Assignee | ||
Comment 13•6 years ago
|
||
Maybe the headers should be just parsed and reprocessed at a later stage if that pref is set.
I think that would require assuming the header format on the receiver site and rewriting the parsing function in C++, and that does not seem like a great solution to me.
How about this instead? I added an optional argument to the JS function which encodes the headers and is called by nsMsgSend.cpp.
Comment 14•6 years ago
|
||
| Assignee | ||
Comment 15•6 years ago
|
||
Seems like a way forwards. Please add a test, maybe in https://searchfox.org/comm-central/source/mailnews/mime/jsmime/test/unit/test_header_emitter.js
Sorry for the late reply, I had quite a lot of trouble to build Thunderbird with tests.
I now added a test to comm/mailnews/mime/test/unit/test_structured_headers.js, is that good enough?
::: comm/mailnews/mailnews.js
@@ +28,5 @@pref("mail.suppress_content_language", false);
+// hidden pref for controlling if the Date header is sanitized, by:
+// 1. Converting the date to UTC, to prevent leaking the local time zone.
+// 2. Rounding the date down to the most recent whole minute, to prevent
+// fingerprinting of small clock offsets.Hmm, are you sure you want that? Because that would surely stand out if someone always has 0 seconds on their messages.
Yes, I'm sure that's what we want. You are right that it will be obvious from the headers that the user has this option activated, but we assume that the anonymity set of all users who have this option activated is still bigger than that of users with a specific clock offset. And it's the behavior TorBirdy had for years, which we want to preserve.
Comment 16•6 years ago
|
||
| Assignee | ||
Comment 17•6 years ago
|
||
Comment 18•6 years ago
|
||
Comment 19•6 years ago
|
||
Updated•6 years ago
|
| Assignee | ||
Comment 20•6 years ago
|
||
Thanks!
Comment 21•6 years ago
|
||
Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/98aa0bf2e719
Add pref mail.sanitize_date_header that if set converts date to UTC and rounds to closest minute. r=mkmelin
Description
•