fix(audit L1): Schleifen in module.advanced.loop brauchen list_users (Benutzer) bzw. read_private_posts (any, attachment, leere subTypes), auch beim Kopieren
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
9c1d5fad22
commit
4a8a889f93
@@ -455,4 +455,33 @@ final class AttrWriterTest extends TestCase
|
||||
self::assertSame([], $adminRemoval['errors']);
|
||||
self::assertArrayNotHasKey('lottie', $adminRemoval['attrs']);
|
||||
}
|
||||
|
||||
/** Audit L1: the loop state of desktop.value is checked where attrs are written; other writes stay as they are. */
|
||||
public function testRefusesALoopThatNeedsRightsTheAccountLacks(): void
|
||||
{
|
||||
$writer = new AttrWriter(
|
||||
DiviFixtures::catalog(),
|
||||
ComposeFixture::placeholders(),
|
||||
new ValueCleaner(
|
||||
DiviFixtures::catalog(),
|
||||
ComposeFixture::references(),
|
||||
ComposeFixture::sanitizer(false, false, false)
|
||||
)
|
||||
);
|
||||
$loop = static fn (array $value): array => ['module.advanced.loop' => ['desktop' => $value]];
|
||||
|
||||
$users = $writer->apply('divi/text', self::TEXT, $loop(['enable' => 'on', 'queryType' => 'user_roles']), 'attrs');
|
||||
self::assertStringContainsString('list_users', $users['errors']['attrs.module.advanced.loop'] ?? '');
|
||||
self::assertArrayNotHasKey('module', $users['attrs']);
|
||||
|
||||
$posts = $writer->apply('divi/text', self::TEXT, $loop(['enable' => 'on']), 'attrs');
|
||||
self::assertStringContainsString('read_private_posts', $posts['errors']['attrs.module.advanced.loop'] ?? '');
|
||||
|
||||
$off = $writer->apply('divi/text', self::TEXT, $loop(['enable' => 'off']), 'attrs');
|
||||
self::assertSame([], $off['errors']);
|
||||
$safe = $writer->apply('divi/text', self::TEXT, $loop(
|
||||
['enable' => 'on', 'queryType' => 'post_types', 'subTypes' => [['value' => 'post']]]
|
||||
), 'attrs');
|
||||
self::assertSame([], $safe['errors']);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user