Review main Merged

95103[BUGFIX] Sanitize children before unwrapping a/h1-h6 in preview

Oliver Hader CR +2 V +2 Normal +77 −31 updated 08/05/26, 11:40

Commit message

UnwrapTagVisitor reparented the children of <a> and <h1> to <h6>
in enterNode(), before the sanitizer's CommonVisitor ever visited
them. This let disallowed or dangerous nested markup (e.g. script
tags, event attributes, unknown tags) bypass sanitization entirely
and reach the backend page module preview unmodified.

This change moves the unwrap logic to leaveNode(), which runs
after a node's children have already been traversed and sanitized,
so only already-sanitized content is reparented. enterNode() is
now a pure passthrough.

Note: This issue is not classified as a security vulnerability,
since the script execution via the nested payloads is blocked by
the backend Content Security Policy, which does not permit inline
scripts or event handlers.

Reported to the security team by HDWSec (https://hdwsec.fr).

Review

  • Code review CR +2 Done
    • Oliver Hader +2
    • Georg Ringer +1
    • Oliver Klee +1
    • Simon Schaufelberger +1
  • Verified V +2 Done
    • Oliver Hader +2
    • Georg Ringer +1
    • Oliver Klee +1
    • Simon Schaufelberger +1
    • core-ci +1 CI

Issues 1

Files 3

Review log 810

  1. Oliver Hader uploaded patch set 1 08/04/26, 12:19

  2. core-ci voted on patch set 1 V -1 08/04/26, 12:29 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/105942

  3. Oliver Hader uploaded patch set 2 V -1 08/04/26, 12:59

  4. core-ci voted on patch set 2 V +1 08/04/26, 13:07 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/105947

  5. Oliver Klee voted on patch set 2 V +1 08/04/26, 13:34

  6. Oliver Klee voted on patch set 2 CR +1 08/05/26, 08:00

  7. Georg Ringer voted on patch set 2 CR +1 V +1 08/05/26, 08:30

  8. Simon Schaufelberger voted on patch set 2 CR +1 V +1 08/05/26, 09:17

  9. Oliver Hader voted on patch set 2 CR +2 V +2 08/05/26, 11:39

  10. Oliver Hader merged patch set 3 08/05/26, 11:40