mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 20:30:23 +00:00
Prevent stored XSS in the block editor.
Prevent escaped unicode characters become unescaped in unsafe HTML during JSON decoding. Props: aduth, epiqueras, git-svn-id: https://develop.svn.wordpress.org/trunk@46896 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -304,6 +304,24 @@ class WP_Test_Block_Type extends WP_UnitTestCase {
|
||||
$this->assertFalse( has_block( 'core/fake' ) );
|
||||
}
|
||||
|
||||
public function test_post_has_block_serialized_name() {
|
||||
$content = '<!-- wp:serialized /--><!-- wp:core/normalized /--><!-- wp:plugin/third-party /-->';
|
||||
|
||||
$this->assertTrue( has_block( 'core/serialized', $content ) );
|
||||
|
||||
/*
|
||||
* Technically, `has_block` should receive a "full" (normalized, parsed)
|
||||
* block name. But this test conforms to expected pre-5.3.1 behavior.
|
||||
*/
|
||||
$this->assertTrue( has_block( 'serialized', $content ) );
|
||||
$this->assertTrue( has_block( 'core/normalized', $content ) );
|
||||
$this->assertTrue( has_block( 'normalized', $content ) );
|
||||
$this->assertFalse( has_block( 'plugin/normalized', $content ) );
|
||||
$this->assertFalse( has_block( 'plugin/serialized', $content ) );
|
||||
$this->assertFalse( has_block( 'third-party', $content ) );
|
||||
$this->assertFalse( has_block( 'core/third-party', $content ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders a test block without content.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user