Closed Bug 1785031 Opened 2 years ago Closed 2 years ago

importing secret key impossible after importing profile

Categories

(MailNews Core :: Security: OpenPGP, defect, P1)

Thunderbird 104

Tracking

(Not tracked)

VERIFIED DUPLICATE of bug 1790610

People

(Reporter: NicolasWeb, Unassigned)

References

(Depends on 1 open bug)

Details

Attachments

(2 files)

Attached image Import Key - TB key Mgr.jpeg (deleted) —

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:105.0) Gecko/20100101 Firefox/105.0

Steps to reproduce:

1.	Open PGP Key manager
2.	Menu : Save your secret key to a file
3.	Start Thunderbird with a new profile from scratch
4.	Try to add a personal Key
5.	Close the account settings tab and reopen it to the e2ee panel
6.	Keep or delete the personal key configured but not found
7.	Try to import a secret key using the OpenPGP Key manager

Actual results:

No key is imported. Unable to import my secret/private from my account.
Step 4 lead to a never ending throbber (with no error message at all), before asking for the passphrase.
Step 5 the UI says the personal key is configured but not found. No key shown in the OpenPGP key manager.
Step 7 lead to an error message
[Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISecretDecoderRing‧decryptString]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: chrome://openpgp/content/modules/masterpass‧jsm :: _readPasswordFromFile :: line 229" data: no]

Expected results:

Importing a personal key though directly the Personal key button, or the OpenPGP Key Manager should work.
Tested on macOS 10.13
TB 104b3

Attached image Key info - GPG Keychain.jpeg (deleted) —

Are you saying there's a problem at step #4?
It seems to work for me, though I notice for the import-from-file case "None" is selected after configuration, and you then have to select the key to use.

Component: Security → Security: OpenPGP
Product: Thunderbird → MailNews Core

Yes, I have an issue at steps 4 and 7 (you can even do 1 -> 2 -> 3 -> 7).
I tried the same on Windows 11 Tb104b6, and have the exact same issue.

I made a screen capture to show you what happened. (I'll delete it as soon as you watched it ; maybe wait for 22 sec to get the mouse moving, maybe...)
https://nuage.liiib.re/s/DNLkeaBmDKjt5Ld

Let me know how I can help going forward, please.
(Thanks for triaging :) )

Flags: needinfo?(mkmelin+mozilla)

I'm testing on Daily, so perhaps there's a chance beta is missing some patch, though I don't recall anything.

Are you using a primary password?
Does the behavior change if you have the other instance of thunderbird closed when importing?

Flags: needinfo?(mkmelin+mozilla)

I tried on Daily and have the exact same issue.
Yes, I'm using a primary password. If I disable it, I still have the same issue.
I just kept opened both instances of Thunderbird for the screen capture. The behavior is the same if they run side by side or one after each.

Okay, I forgot a step in my STR : import profile from another Thunderbird installation.
If I don't import my profile, importing the key works fine on Daily.

The updated Steps to reproduce are:

  1. Open PGP Key manager
  2. Menu : Save your secret key to a file
    3.1 Start Thunderbird with a new profile from scratch
    3.2 Import your profile from another Thunderbird installation.
  3. Try to add a personal Key
  4. Close the account settings tab and reopen it to the e2ee panel
  5. Keep or delete the personal key configured but not found
  6. Try to import a secret key using the OpenPGP Key manager
Summary: importing secret key impossible → importing secret key impossible after importing profile

Thanks, I guess this is one angle to bug 1779022 then.

Depends on: 1779022

If the Thunderbird profile import feature corrupts profiles, in a way that breaks usual management functionality, then I'd consider the profile import feature broken, and it should be either disabled, or changed to fully stay away from all NSS files and OpenPGP files.

Flags: needinfo?(sancus)
Status: UNCONFIRMED → NEW
Ever confirmed: true
Severity: -- → S2
Priority: -- → P1

So after using profile import, ANY private key import via the OpenPGP Key Manager is permanently broken?

@Thomas can you confirm?

Flags: needinfo?(sancus) → needinfo?(bugzilla2007)

Hi Andrei, I think it isn't necessary to get help from Thomas here. We know the feature is broken, we get multiple reports about it. I think it's now a developer task to analyze which scenarios break, which scenarios we need to disable, and how to repair it. I will start looking into it.

Flags: needinfo?(bugzilla2007)

(In reply to Andrei Hajdukewycz [:sancus] from comment #9)

So after using profile import, ANY private key import via the OpenPGP Key Manager is permanently broken?

If the user runs into a problem, yes, the problem is permanent. And the breakage isn't limited to key import. The breakage includes OpenPGP key usage, also key generation. It even breaks checking email for an account that doesn't have a saved password yet. (Because we run through a code path that fails to execute, because of the corruption).

I can reproduce the bug in the following scenario:

  • user already has an OpenPGP key imported
  • user does NOT have any saved passwords (logins.json is absent)

In this scenario, file encrypted-openpgp-passphrase.txt is present in the target profile. Target profile file key4.db gets overwritten with file key4.db from the source profile, with the consequence that encrypted-openpgp-passphrase.txt in the target directory can no longer be decrypted.

I don't know if there is way for this this bug to happen for users who already have saved logins, too.

(In reply to Kai Engert (:KaiE:) from comment #11)

I can reproduce the bug in the following scenario:

  • user already has an OpenPGP key imported

I found it isn't limited to this scenario.

It happens to everyone who:

  • starts thunderbird at least once
  • has not saved a password yet
  • quits and restarts thunderbird at least once
  • then imports another profile

In this scenario, the user already has a file encrypted-openpgp-passphrase.txt with an automatic passphrase, which no longer matches key4.db

This is sufficient for the following failures with OpenPGP.

NicolasWeb (original reporter):

You said you were using Thunderbird 104 on the day (August 16) you reported the bug.

According to the release calendar, it looks like you were using the beta channel.

Do you still have the Thunderbird profile that you were using at the time you reported this bug?
If yes, could you please try the latest beta with that profile again?
Thunderbird should automatically repair your profile, and secret key import should work again.

Flags: needinfo?(mozilla.nicolasweb)

I would like to mark this as a duplicate of bug 1790610, which should have fixed the issue.

Nicolas, please let us know if my assumption is incorrect. If it isn't, then we'd need to reopen this bug.

Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → DUPLICATE

(In reply to Kai Engert (:KaiE:) from comment #13)

Do you still have the Thunderbird profile that you were using at the time you reported this bug?
If yes, could you please try the latest beta with that profile again?
Thunderbird should automatically repair your profile, and secret key import should work again.

Yes, I still have this profile, and yes, with it get fixed and I'm able to import successfully again my private secret key (using both GPG Key manager or 'add a personal key' button) :)))
I even checked, I still have my saved passwords ;)
Thanks !!

Flags: needinfo?(mozilla.nicolasweb)

Thank you for confirming.

Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: