Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SMimeP7M/parse #1159

Open
chibenwa opened this issue Aug 19, 2024 · 4 comments
Open

SMimeP7M/parse #1159

chibenwa opened this issue Aug 19, 2024 · 4 comments
Labels
customer enhancement New feature or request

Comments

@chibenwa
Copy link
Member

Why?

Some smime messages consists of a p7m attachment that encapsulate the mime structure and their display is suboptimal in the webmail

Screenshot from 2024-08-19 14-44-42

We wishes to offer essentials for nicer display in the wemails

IE when opening the mail a display similar to the one of thunderbird:

Screenshot from 2024-08-19 15-01-56

What

Offer a SMimeP7M/parse JMAP route that would allow parsing those messages and expose them as EmailBodyStructure

Note that we also need to handle download of such body parts.

{
  "using": [
    "urn:ietf:params:jmap:core",
    "urn:ietf:params:jmap:mail",
    ""],
  "methodCalls": [[
    "SMimeP7M/parse",
    {
      "accountId": "29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
      "blobIds": [ "p7mPartId" ],
      "fetchTextBodyValues": true,
      "fetchHTMLBodyValues": true,
      "bodyProperties":["partId", "blobId", "size", "name", "type", "charset", "disposition", "cid"]
    },
    "c1"]]
}

Would return:

{
    "sessionState": "${SESSION_STATE.serialize}",
    "methodResponses": [
        [
            "Email/parse",
            {
                "accountId": "29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
                "parsed": {
                    "${messageId.serialize()}_3": {
	"htmlBody": [{
		"charset": "UTF-8",
		"size": 47,
		"partId": "2",
		"blobId": "smimep7m_${messageId.serialize()}?1_1",
		"type": "text/plain"
	}],
                        "bodyValues": {
                            "2": {
                                "value": "test body\\r\\n",
                                "isEncodingProblem": false,
                                "isTruncated": false
                            }
                        },
                        "attachments": [
                            {
                                "partId": "3",
                                "blobId": "smimep7m_${messageId.serialize()}?1_2",
                                "size": 16,
                                "name": "whatever.txt",
                                "type": "text/plain",
                                "charset": "UTF-8",
                                "disposition": "attachment"
                            }
                        ],
                        "size": 797,
                        "blobId": "smimep7m_${messageId.serialize()}",
                        "messageId": [
                            "[email protected]"
                        ]
                    }
                }
            },
            "c1"
        ]
    ]
}

Note that body parts blobId follow the following syntax: smimep7m_{nested-blobid}?{path-to-mimepart within smime message}

So smimep7m_123456?1_2_3 means take message 123456 and interpret it as smimep7m then take the first body part of the first multipart and then the second body of the second multipart and then the trird of the most inner multipart.

Nesting a p7m in a p7m is out of scope.

Subtasks

  • Specification
  • Implementation
@chibenwa chibenwa added enhancement New feature or request customer labels Aug 19, 2024
@Arsnael
Copy link
Member

Arsnael commented Aug 22, 2024

@chibenwa So as we are grooming this and team seems a bit confused, to confirm what you want here:

I have an attachment in a mail encapsulating a smime structure and with the jmap request SMimeP7M/parse we should parse and decode it, return the result that then the front would display in the message view correct?

Ok. We obviously should check as well then that the smime signature on the attachment is correct too, and return I guess an error if it's not valid instead?

@chibenwa
Copy link
Member Author

chibenwa commented Aug 22, 2024

Correct

But we do not need to check signature again: thats done beforehand and result is exposed in mail headers...

@chibenwa
Copy link
Member Author

No no no error if invalid signature or you cannot read smime message with unknown ca for instance

Other mua like tb do not behave this way

@chibenwa
Copy link
Member Author

Unscheduled as our customer also seem to use Content-Type: multipart/signed

Screenshot from 2024-08-22 15-45-10

Display on the webmail is nice enough.

It's not unlikely webmail display of Content-Type: application/pkcs7-mime; can be disregarded altogether...

I asked @guimard clarifications.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customer enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants