Skip to content

Do not validate detached signature for unencrypted messages #7120

@link2xt

Description

@link2xt

Here we validate detached signature for mail (not decrypted_mail):

core/src/mimeparser.rs

Lines 484 to 489 in a89b632

let mail = mail.as_ref().map(|mail| {
let (content, signatures_detached) = validate_detached_signature(mail, &public_keyring)
.unwrap_or((mail, Default::default()));
signatures.extend(signatures_detached);
content
});

If the signature is valid, we put it into signatures set, but according to its documentation non-empty signatures set means that the message is encrypted and signed:

core/src/mimeparser.rs

Lines 79 to 84 in a89b632

/// Set of valid signature fingerprints if a message is an
/// Autocrypt encrypted and signed message.
///
/// If a message is not encrypted or the signature is not valid,
/// this set is empty.
pub signatures: HashSet<Fingerprint>,

If the messages is just signed with a detached signature, but not encrypted, it should be treated as insecure message like we do for normal signatures.

Noticed this while re-reading the code that validates signatures, opened a related refactoring PR: #7119

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is not working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions