#6276 Improve message parsing for signed message - #6277
Conversation
|
Hi @sosnovsky - This one is ready for a review. Thanks! |
sosnovsky
left a comment
There was a problem hiding this comment.
works well, just a couple minor improvements 👍
| type SendingType = 'to' | 'cc' | 'bcc'; | ||
|
|
||
| export class Mime { | ||
| private static readonly MAX_SIGNED_CONTENT_DEPTH = 50; |
There was a problem hiding this comment.
there is similar recursive call in
which can cause extension lag for nested signed content. we'll need to implement similar fix there, but let's leave it for separate PR
There was a problem hiding this comment.
Got it - Will remember this one and fix it on separate PR after this one.
This comment was marked as outdated.
This comment was marked as outdated.
| const currentSubject = current.headers.subject?.[0]?.value; | ||
| if (!Mime.isSignedContentNode(current)) { | ||
| return currentSubject || fallbackSubject; | ||
| } | ||
| fallbackSubject = currentSubject || fallbackSubject; |
There was a problem hiding this comment.
it's possible for multipart/mixed content to include both signed and unsigned parts. current code stops when it encounters a non-signed node, so it can miss a nested signed node. let’s perform search for another signed node in this case:
const currentSubject = current.headers.subject?.[0]?.value;
fallbackSubject = currentSubject || fallbackSubject;
if (!Mime.isSignedContentNode(current)) {
const nestedSignedContentNode = Mime.retrieveSignedContentNode([current]);
if (!nestedSignedContentNode) {
return fallbackSubject;
}
current = nestedSignedContentNode;
continue;
}There was a problem hiding this comment.
I apologize, I missed that part. I have rechecked it again and fix the said behavior.
|
Hi @sosnovsky - This one is ready for a review. Thanks! |
sosnovsky
left a comment
There was a problem hiding this comment.
all good now, thanks!
This PR improve message parsing for signed message and prevents recursive parsing.
close #6276
Tests (delete all except exactly one):
To be filled by reviewers
I have reviewed that this PR... (tick whichever items you personally focused on during this review):