Review 12.4 Merged

92298[SECURITY] Harden message deserialization in `FileSpool` transport

Oliver Hader CR +2 V +2 Hard +357 −19 updated 01/13/26, 11:46

Commit message

Messages used for delayed transport using the `FileSpool` transport
are serialized `SentMessage` object representations. Deserializing
queued messages must therefore accept only `SentMessage` and related
classes. An existing security measure to limit deserialization to said
classes is already in place, but contained a typo. Hence, the security
measures did not have any effect.

This is now fixed and all explicitly allowed classes are now properly
configured for the `unserialize` command. However, since the current
`symfony/mailer` implementations are constructed to include a various
range of related classes, which may also be extended by custom
implementations, it's quite hard to list all allowed classes in a static
list. In order to cover this specific scenario, a new
`PolymorphicDeserializer` component is introduced. It performs an
extended deserialization, which is able to construct the list of allowed
classes by inspecting the serialized payload: All extracted objects must
match a predefined list of allowed classes or at least implement any of
the listed interfaces, otherwise deserialization will fail.

The `PolymorphicDeserializer` component is now consumed by the
`FileSpool` transport. In addition, the `flushQueue` operation was
slightly adjusted to enforce `SentMessage` objects and skip other
serialized messages. In case any serialized messages contain disallowed
or unsupported objects, an error will now be logged. The serialized
message will be removed in any case – either after transport or when
being skipped due to the described behavior – to avoid having invalid
messages in place.

Review

  • Code review CR +2 Done
    • Oliver Hader +2
  • Verified V +2 Done
    • Oliver Hader +2

Issues 1

Files 6

Review log 34

  1. Oliver Hader uploaded patch set 1 01/13/26, 11:32

  2. Oliver Hader commented on patch set 1 CR +2 V +2 01/13/26, 11:32

    Auto-approved
  3. Oliver Hader merged patch set 2 01/13/26, 11:32

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