View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0037495 | Plugin - EmailReporting | General | public | 2026-11-10 03:57 | 2026-11-10 13:31 |
| Reporter | Nokman | Assigned To | SL-Gundam | ||
| Priority | normal | Severity | major | Reproducibility | always |
| Status | resolved | Resolution | fixed | ||
| Summary | 0037495: multipart/signed parsing loses message body after removal of reference parameter | ||||
| Description | Severity: major Environment:
Impact: EmailReporting accepts and associates the message with an issue, but the parser loses the signed message body. The import can therefore appear successful while the actual support request or reply is missing. This is not a rejection of an untrusted certificate. The problem occurs during MIME content extraction. A test message with a cryptographically valid signature reproduced the issue. Description:
In isolated parser tests, the extracted message body is null despite the signed content containing a text/plain body. Reproduction:
The attachment has a cryptographically valid S/MIME signature using a self-signed test certificate. Certificate trust is not implied. Confirmed end-to-end:
The same import subsequently associated the message with the intended test issue. Body loss was independently confirmed in isolated tests using the identical parser. Cause:
The method removes msg_body/sig_hdr/sig_body from the shared structure object. It then assigns the merged decoded structure only to its local variable, so the caller does not receive the decoded message body. For a signed text/plain body, an empty parts array also remains after removing the signature fields. setParts() rejects this array and prints the warning with an empty array key. Isolated diagnostic tests:
Tests used PHP 8.2 with the installed parser and dependencies, without loading MantisBT or accessing a mailbox. Expected: No production code was modified. The diagnostic changes have not been validated against complex nested MIME structures. | ||||
| Tags | No tags attached. | ||||
| Attached Files | |||||
|
I need to investigate further but so far 2 changes are required. This needs to be added here: https://github.com/mantisbt-plugins/EmailReporting/blob/master/core/Mail/Parser.php#L597
As you've found $structure needs to be passed by reference. This was changed here by mistake https://github.com/mantisbt-plugins/EmailReporting/commit/2d4141e79fea809fbe5932b230936ee02e3fab83 |
|
|
Thank you for investigating. I applied both suggested changes: restoring &$structure in parse_signed_content() and returning early when $parts is empty in setParts(). Local tests now extract the body correctly from the signed test message without warnings. Signed and unsigned test structures with attachments also passed. We then deployed the changes and resent the S/MIME-signed test email through the regular mail import. It was associated with the intended issue, and neither the MIME warning nor the empty “Array key:” message occurred. |
|
|
No further changes beyond the once specified were necessary. Changes made: https://github.com/mantisbt-plugins/EmailReporting/commit/58ed5b93024de568050819601865e8e7d9066b89 |
|
|
Thank you for reporting this issue. |
|