fix: Sicherheitstest für Redakteure ohne unfiltered_html prüft einen echten Builder-Pfad
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
2ed6093f97
commit
fe8a01f878
@@ -145,15 +145,20 @@ final class DiviPresetsSetAbilityTest extends TestCase
|
||||
self::assertArrayHasKey('items[1]', $result['fields']);
|
||||
}
|
||||
|
||||
public function testEditorWithoutUnfilteredHtmlIsRefusedForRawCss(): void
|
||||
/** Review Focus 1 (final review I-1): a catalog-known builder-only path, refused for editors only. */
|
||||
public function testEditorWithoutUnfilteredHtmlIsRefusedForBuilderOnlyFields(): void
|
||||
{
|
||||
$result = $this->ability(false)->execute(['items' => [[
|
||||
'module' => 'button', 'name' => 'Mit CSS',
|
||||
'attrs' => ['css' => ['desktop' => ['mainElement' => 'color:red']]],
|
||||
]]]);
|
||||
$input = ['items' => [[
|
||||
'module' => 'button', 'name' => 'Mit HTML',
|
||||
'attrs' => ['module.advanced.html' => ['desktop' => ['elementType' => 'div']]],
|
||||
]]];
|
||||
|
||||
self::assertNotTrue(is_array($result) && ($result['ok'] ?? false));
|
||||
self::assertContains(Errors::codeOf($result), ['validation_failed', 'invalid_attr_path']);
|
||||
$editor = self::assertToolError($this->ability(false)->execute($input), 'validation_failed');
|
||||
self::assertArrayHasKey('items[0].attrs.module.advanced.html', $editor['fields']);
|
||||
self::assertStringContainsString('Divi-Builder', $editor['fields']['items[0].attrs.module.advanced.html']);
|
||||
self::assertStringContainsString('unfiltered_html', $editor['fields']['items[0].attrs.module.advanced.html']);
|
||||
|
||||
self::assertToolError($this->ability(true)->execute($input), 'confirm_required');
|
||||
}
|
||||
|
||||
public function testFromNodeReadsThePage(): void
|
||||
|
||||
Reference in New Issue
Block a user