Closed Bug 2026356 Opened 5 months ago Closed 3 days ago

Failure to sign with an external GnuPG key that requires the use of a signing subkey

Categories

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

defect
Points:
5

Tracking

(thunderbird_esr140? affected)

RESOLVED FIXED
Tracking Status
thunderbird_esr140 ? affected

People

(Reporter: KaiE, Assigned: KaiE)

References

(Blocks 1 open bug)

Details

(Whiteboard: [mailsec-broken-fixwanted])

Attachments

(2 files)

In the following scenario, adding a digital OpenPGP signature fails:

  • external GnuPG configuration is enabled
  • for that key, the primary key doesn't have signing capability

The current code asks GPG for a key handle to the configured external key ID, and then adds that key handle as a signer.

Apparently that fails in certain scenarios. GPGME reports a failure to sign.

I assume that GPGME doesn't have the capability to automatically select the corresponding signing subkey, but rather returns a failure because the given key handle cannot be used directly for signing.

This bug was reported for a split-qubes configuration.

I suggest to fix this in the following way:

If Thunderbird is asked to use signing with external GnuPG, TB should inspect the corresponding public key (that the user was required to import, that's a precondition for using external secret key, as documented).

The code should find the most recently created subkey, and prefer that one (we use that preference already when selecting a suitable encryption key). If non exists, it should fall back to use the primary key (if it has signing capability).

That approach should fix this bug.

Whiteboard: [mailsec-broken-fixwanted]
Assignee: nobody → kaie
Severity: -- → S3
Priority: -- → P3
Attachment #9558336 - Attachment description: WIP: Bug 2026356 - Prefer signing subkey in external secret key configuration, only use primary as fall back. → Bug 2026356 - Prefer signing subkey in external secret key configuration, only use primary as fall back. r=mkmelin
Status: NEW → ASSIGNED
Points: --- → 5

I don't want to require the gnupg tools to be available in our CI environment.
But it would be nice to have an automated test that we can execute manually, locally on a developer machine.

Conflicts found while landing. Please Rebase.

Pushed by arschmitz@thunderbird.net:
https://hg.mozilla.org/comm-central/rev/106037f54581
Prefer signing subkey in external secret key configuration, only use primary as fall back. r=mkmelin
https://hg.mozilla.org/comm-central/rev/805e3cdb2427
Add an optional Linux-only external-gnupg test (only if binaries are installed). r=mkmelin

Status: ASSIGNED → RESOLVED
Closed: 3 days ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: