Thunderbird 78.5.1: Importing OpenPGP keys from file is broken on macOS
Categories
(MailNews Core :: Security: OpenPGP, defect, P1)
Tracking
(thunderbird_esr78+ fixed, thunderbird84 affected)
People
(Reporter: KaiE, Assigned: KaiE)
References
(Regression)
Details
(Keywords: regression)
Attachments
(1 file, 1 obsolete file)
|
1.74 KB,
patch
|
mkmelin
:
review+
wsmwk
:
approval-comm-beta-
wsmwk
:
approval-comm-esr78+
|
Details | Diff | Splinter Review |
Using Thunderbird 78.5.1 try to import a secret key, it doesn't matter if opened from account settings or openpgp key manager.
After selecting exactly one file for import, import fails.
Error console shows:
Uncaught (in promise) TypeError: fileObj.exists is not a function
readFile chrome://openpgp/content/modules/files.jsm:200
getKeyListFromKeyFile chrome://openpgp/content/modules/key.jsm:188
importSecretKey chrome://openpgp/content/ui/keyWizard.js:792
files.jsm:200:17
I cannot reproduce on Linux.
I can reproduce on macOS.
| Assignee | ||
Comment 1•6 months ago
|
||
The patch from bug 1665145 caused this regression.
https://hg.mozilla.org/releases/comm-esr78/rev/96ce609a4097d981b188c7e352c0fcca57d2361f
Search this commit for gotFile. It removed a call to QueryInterface.
I'm working on the fix.
Comment 2•6 months ago
|
||
Ouch, sorry about that.
Thanks for fixing it.
| Assignee | ||
Comment 3•6 months ago
|
||
| Assignee | ||
Comment 4•6 months ago
|
||
Comment on attachment 9191373 [details] [diff] [review]
1680757-v1.patch
This patch fixes the issue for me
| Assignee | ||
Updated•6 months ago
|
Comment 5•6 months ago
|
||
Comment on attachment 9191373 [details] [diff] [review] 1680757-v1.patch Review of attachment 9191373 [details] [diff] [review]: ----------------------------------------------------------------- ::: mail/extensions/openpgp/content/modules/dialog.jsm @@ +481,5 @@ > // Loop through multiple selected files only if the dialog was triggered > // to open files and the `multiple` boolean variable is true. > if (!save && multiple) { > for (let file of filePicker.files) { > + files.push(file.QueryInterface(Ci.nsIFile)); What type is it listing before the QI? Seems like there's some bug deeper down here on mac. QI shouldn't be needed after bug 1484496. @@ +486,3 @@ > } > } else { > + files.push(filePicker.file.QueryInterface(Ci.nsIFile)); This one is clearly nsIFile in the idl, so QI can't be needed here. https://searchfox.org/mozilla-central/source/widget/nsIFilePicker.idl#155
| Assignee | ||
Updated•6 months ago
|
| Assignee | ||
Comment 6•6 months ago
|
||
(In reply to Magnus Melin [:mkmelin] from comment #5)
files.push(file.QueryInterface(Ci.nsIFile));What type is it listing before the QI?
How should I list its type?
| Assignee | ||
Comment 7•6 months ago
|
||
Magnus suggested to use either console.dir() or dump();
Those give me XPCWrappedNative_NoHelper (with some very base elements, when opening the object on the console, like QueryInterface), and [xpconnect wrapped nsISupports].
| Assignee | ||
Comment 8•6 months ago
|
||
(In reply to Magnus Melin [:mkmelin] from comment #5)
This one is clearly nsIFile in the idl, so QI can't be needed here.
https://searchfox.org/mozilla-central/source/widget/nsIFilePicker.idl#155
Yes, confirming.
I'll update the patch to QI for the list, only.
| Assignee | ||
Comment 9•6 months ago
|
||
| Assignee | ||
Comment 10•6 months ago
|
||
jcranmer has suggested to call .toString() on the object. For the object we obtain from the iteration, it's the same as the info I got with dump(): [xpconnect wrapped nsISupports]
Updated•6 months ago
|
Comment 11•6 months ago
|
||
Comment on attachment 9191402 [details] [diff] [review] 1680757-v2.patch Review of attachment 9191402 [details] [diff] [review]: ----------------------------------------------------------------- ::: mail/extensions/openpgp/content/modules/dialog.jsm @@ +481,5 @@ > // Loop through multiple selected files only if the dialog was triggered > // to open files and the `multiple` boolean variable is true. > if (!save && multiple) { > for (let file of filePicker.files) { > + files.push(file.QueryInterface(Ci.nsIFile)); will add a comment and land
Comment 12•6 months ago
|
||
Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/a45d3c5805b3
"Thunderbird 78.5.1: Importing OpenPGP keys from file is broken on macOS" r=mkmelin
Comment 13•6 months ago
|
||
kmag, any idea why the filepicker.files nsISimpleEnumerator elements need QI on Mac for this case?
| Assignee | ||
Comment 14•6 months ago
|
||
Comment on attachment 9191402 [details] [diff] [review]
1680757-v2.patch
[Approval Request Comment]
Regression caused by (bug #): 1665145
User impact if declined: broken key import on macOS
Testing completed (on c-c, etc.): manually
Risk to taking this patch (and alternatives if risky): low
| Assignee | ||
Comment 15•6 months ago
|
||
(In reply to Magnus Melin [:mkmelin] from comment #13)
kmag, any idea why the filepicker.files nsISimpleEnumerator elements need QI on Mac for this case?
In chat, jcranmer mentioned in his understanding it's expected that nsISimpleEnumerator gives just nsISupports.
Comment 16•6 months ago
|
||
Comment on attachment 9191402 [details] [diff] [review]
1680757-v2.patch
[Triage Comment]
This won't reach beta via uplift.
Approved for esr78
| Assignee | ||
Comment 17•6 months ago
|
||
Comment 20•6 months ago
|
||
candidate build works on Mac, per bug 1682099
Comment 21•4 months ago
|
||
It looks like the Cocoa file picker implementation doesn't pass an interface when it creates its enumerator as opposed to other implementations which do.
We should probably fix that.
Description
•