Review main Merged

92329[BUGFIX] Allow AbstractPart and File in spooled email deserialization

Markus Klein CR +2 V +2 Normal +111 −30 updated 01/19/26, 09:43

Commit message

The FileSpool deserialization previously failed when processing complex
emails containing Symfony Mime AbstractPart or File objects, causing
valid messages to be rejected and deleted. This adds AbstractPart and
File to the allowed classes list in the PolymorphicDeserializer.

Additionally, improve error handling by preserving failed messages:
- Rename deserialization failures to ".invalid" instead of deleting
- Retain ".sending" files when transport fails (allows retry)
- Include original exception details in error logs for debugging

This enables proper handling of emails with attachments, embedded
files, and complex MIME structures while improving troubleshooting
capabilities through better error preservation and logging.

Review

  • Code review CR +2 Done
    • Benjamin Franzke +2
    • Oliver Hader +1
    • Elias Häußler +1
  • Verified V +2 Done
    • Benjamin Franzke +2
    • Oliver Klee +1
    • Elias Häußler +1
    • core-ci +1 CI

Issues 2

Files 3

Review log 4863

Show 3038 earlier messages
  1. Markus Klein uploaded patch set 1 01/14/26, 13:43

  2. Markus Klein uploaded patch set 2 01/14/26, 13:45

  3. Markus Klein updated the commit message in patch set 3 01/14/26, 13:46

  4. core-ci voted on patch set 1 V +1 01/14/26, 13:53 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/93442

  5. core-ci voted on patch set 2 V +1 01/14/26, 13:54 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/93443

  6. core-ci voted on patch set 3 V +1 01/14/26, 13:56 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/93444

  7. Elias Häußler commented on patch set 3 01/14/26, 16:19

    Can we have a test case to verify that the .sending file is actually NOT deleted on transport failure? I can take care of that later today, if no one else is faster.
  8. Elias Häußler uploaded patch set 4 V +1 01/14/26, 17:32

  9. Elias Häußler commented on patch set 4 01/14/26, 17:33

    Reply

    Done
  10. Elias Häußler voted on patch set 4 CR +1 V +1 01/14/26, 17:37

  11. core-ci voted on patch set 4 V +1 01/14/26, 17:40 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/93467

  12. Andreas Kienast voted on patch set 4 CR +1 01/15/26, 06:49

  13. Markus Klein commented on patch set 4 01/15/26, 08:14

    Reply

    Thanks, thought about a test too, but didn't have the time yesterday.
  14. Oliver Klee voted on patch set 4 V +1 01/15/26, 09:05

  15. Markus Klein commented on patch set 4 01/15/26, 15:16

    FileSpoolTest.php:120

    strange, this fails on v12 in the CI https://git.typo3.org/typo3/CI/cms/-/jobs/5200185 The created exception contains no 10 digit exception code as second argument, in or below this line: sysext/core/Tests/Unit/Mail/FileSpoolTest.php:4418:new RuntimeException('Transport failure'));
  16. Elias Häußler uploaded patch set 5 CR +1 V +1 01/15/26, 15:35

  17. Elias Häußler commented on patch set 5 01/15/26, 15:35

    FileSpoolTest.php:120 Reply

    Done, can you try again with v12?
  18. Elias Häußler commented on patch set 5 01/15/26, 15:36

    I assume there won't be another v14.0 release, since v14.1 is already released next Tuesday. But I'm not sure here, maybe someone can confirm?
  19. core-ci voted on patch set 5 V +1 01/15/26, 15:42 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/93525

  20. Andreas Kienast commented on patch set 5 01/15/26, 15:44

    Reply

    AFAIK this will go into 14.1 (aka "main" right now).
  21. Oliver Klee voted on patch set 5 V +1 01/15/26, 15:44

  22. Elias Häußler updated the commit message in patch set 6 V +1 01/15/26, 15:45

  23. Elias Häußler commented on patch set 6 01/15/26, 15:45

    Reply

    Done
  24. Oliver Klee voted on patch set 6 V +1 01/15/26, 15:53

  25. core-ci voted on patch set 6 V +1 01/15/26, 15:55 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/93526

  26. Markus Klein commented on patch set 6 01/15/26, 16:12

    FileSpoolTest.php:120 Reply

    updated the cherry-pick. but I wonder why we have different rules for exceptions in v12 and v14.
  27. Markus Klein commented on patch set 6 01/15/26, 16:51

    FileSpoolTest.php:120 Reply

    Done
  28. Elias Häußler voted on patch set 6 CR +1 V +1 01/15/26, 17:06

  29. Markus Klein commented on patch set 6 CR -1 V -1 01/16/26, 09:05

    FileSpool.php:162

    I'd drop this or rename the file to something different. it makes debugging impossible, if we delete the root cause. we just had this exception in production, which we patched already
  30. Markus Klein commented on patch set 6 01/16/26, 09:08

    FileSpool.php:162

    ```suggestion rename($file . '.sending', $file . '.invalid'); ```
  31. Markus Klein uploaded patch set 7 CR +1 V +1 01/16/26, 09:10

  32. Markus Klein commented on patch set 7 01/16/26, 09:11

    FileSpool.php:162 Reply

    Done
  33. core-ci voted on patch set 7 V +1 01/16/26, 09:21 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/93569

  34. Markus Klein commented on patch set 7 01/16/26, 09:53

    FileSpool.php:162 Reply

    Done
  35. Markus Klein uploaded patch set 8 V +1 01/16/26, 10:03

  36. Markus Klein uploaded patch set 9 01/16/26, 10:10

  37. Markus Klein updated the commit message in patch set 10 01/16/26, 10:15

  38. core-ci voted on patch set 8 V -1 01/16/26, 10:15 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/93576

  1. Markus Klein uploaded patch set 11 01/16/26, 10:16

  2. core-ci voted on patch set 9 V -1 01/16/26, 10:27 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/93580

  3. core-ci voted on patch set 11 V -1 01/16/26, 10:32 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/93582

  4. core-ci voted on patch set 10 V -1 01/16/26, 10:32 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/93581

  5. Markus Klein uploaded patch set 12 V -1 01/16/26, 12:09

  6. Oliver Hader updated the commit message in patch set 13 01/16/26, 12:18

  7. core-ci voted on patch set 12 V +1 01/16/26, 12:22 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/93595

  8. core-ci voted on patch set 13 V +1 01/16/26, 12:33 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/93600

  9. Oliver Hader voted on patch set 13 CR +1 01/16/26, 12:34

  10. Johannes Kasberger voted on patch set 13 CR +1 V +1 01/16/26, 13:30

  11. Elias Häußler commented on patch set 13 CR -1 01/16/26, 13:31

    As we pretty much depend on an external library (Symfony) when deciding which classes and instances to whitelist for the `unserialize` function, I see it as an important measure to add a test case for the scenario that is fixed by this patch (having attachments in place). I'll take care of that...
  12. Elias Häußler uploaded patch set 14 CR +1 V +1 01/16/26, 13:44

  13. Elias Häußler commented on patch set 14 CR +1 V +1 01/16/26, 13:45

    Reply

    Done
  14. Johannes Kasberger voted on patch set 14 CR +1 V +1 01/16/26, 13:46

  15. Markus Klein commented on patch set 14 01/16/26, 13:50

    FileSpoolTest.php:161

    this should be ```suggestion $email->embed('foo'); ``` because attach is the same as attachfrompath
  16. core-ci voted on patch set 14 V +1 01/16/26, 13:51 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/93605

  17. Elias Häußler commented on patch set 14 01/16/26, 13:55

    FileSpoolTest.php:161 Reply

    The only difference between `attach` and `attachFromPath` for our use-case is that [`attach` adds the body as-is](https://github.com/symfony/symfony/blob/v7.4.3/src/Symfony/Component/Mime/Email.php#L334), while [`attachFromPath` wraps it in a `File` object](https://github.com/symfony/symfony/blob/v7.4.3/src/Symfony/Component/Mime/Email.php#L342), which is what we want to test here. I agree that the naming `inline` is misleading here, but I'd keep the implementation as-is.
  18. Elias Häußler uploaded patch set 15 CR +1 V +1 01/16/26, 13:59

  19. core-ci voted on patch set 15 V +1 01/16/26, 14:06 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/93606

  20. Markus Klein commented on patch set 15 01/16/26, 14:08

    FileSpoolTest.php:161 Reply

    Acknowledged
  21. Oliver Hader voted on patch set 15 CR +1 01/16/26, 15:07

  22. Elias Häußler voted on patch set 15 CR +1 V +1 01/16/26, 16:14

  23. Oliver Klee voted on patch set 15 V +1 01/16/26, 16:51

  24. Benjamin Franzke voted on patch set 15 CR +2 V +2 01/19/26, 07:38

  25. Benjamin Franzke merged patch set 16 01/19/26, 09:43