From 7d0837be6ce95539efa7060e053535f43f0ab4e5 Mon Sep 17 00:00:00 2001 From: Jan-Niclas Loosen Date: Sat, 26 Sep 2026 19:13:58 +0200 Subject: [PATCH] fix(security): raw content refuses Divi markup (audit M1) lit/content-create and lit/content-update refuse content containing the divi/* block delimiters WordPress' block parser accepts or Divi 4 shortcodes, so the builder-only gates (S7/S26) can't be bypassed. Other block markup stays allowed (normal kses). Co-Authored-By: Claude Opus 5.5 (1M context) --- readme.txt | 4 +++ .../WordPress/Content/PostWriter.php | 26 +++++++++++++- .../WordPress/Content/PostWriterTest.php | 36 +++++++++++++++++++ 3 files changed, 65 insertions(+), 1 deletion(-) diff --git a/readme.txt b/readme.txt index 9ce5b29..8cc3e42 100644 --- a/readme.txt +++ b/readme.txt @@ -46,6 +46,10 @@ Einstellungen: Einstellungen → LIT MCP (Verbindung, Zugriff, Tools, Protokoll, Inhalte des Code-Moduls bleiben nur mit unfiltered_html ungefiltert; eigenes HTML, CSS und HTML-Attribute von Modulen schreibt LIT MCP nur für Benutzer mit unfiltered_html. Divis eigene Speicherfilter bleiben aktiv. +* Das Feld content von lit-content-create und lit-content-update nimmt kein Divi-Markup an (Divi-Blöcke + ', + "

x

", + "", + '[et_pb_section][/et_pb_section]', + ]; + foreach ($refused as $content) { + foreach ([true, false] as $isCreate) { + $result = $writer->prepare('page', ['content' => $content], $isCreate); + $payload = self::assertToolError($result, 'validation_failed', $content); + self::assertStringContainsString('Divi', self::errorFields($result)['content']); + self::assertStringContainsString('`divi`', (string) $payload['hint']); + self::assertStringContainsString('lit-divi-', (string) $payload['hint']); + } + } + + $allowed = [ + '

Divi ist toll

', + '', + '', + '

wp:divi/ im Text

', + ]; + foreach ($allowed as $content) { + self::assertIsArray($writer->prepare('page', ['content' => $content], true), $content); + } + } + public function testParentMustBeAReadableNonDescendantEntryOfAHierarchicalType(): void { $writer = $this->writerWithoutFields();