* XSS vulnerability on various unescaped attributes * escape more blocks * Fix misplaced json encode flags * Add escaping to the block names * Update changelog message --------- Co-authored-by: Luigi Teschio <gigitux@gmail.com> Co-authored-by: roykho <roykho77@gmail.com>
This commit is contained in:
parent
542c675963
commit
a66da660f7
|
@ -1,4 +1,4 @@
|
|||
Significance: patch
|
||||
Type: fix
|
||||
|
||||
Hardening against XSS via the Product Button unescaped attribute
|
||||
Enhance escaping for block attributes
|
||||
|
|
|
@ -144,8 +144,8 @@ final class ProductFilterPrice extends AbstractBlock {
|
|||
'data-wc-interactive' => wp_json_encode(
|
||||
array(
|
||||
'namespace' => $this->get_full_block_name(),
|
||||
JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP,
|
||||
)
|
||||
),
|
||||
JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP,
|
||||
),
|
||||
'data-wc-context' => wp_json_encode( $data, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP ),
|
||||
'data-has-filter' => 'no',
|
||||
|
|
|
@ -84,8 +84,8 @@ final class ProductFilterRating extends AbstractBlock {
|
|||
/* translators: %d is the rating value. */
|
||||
'title' => sprintf( __( 'Rated %d out of 5', 'woocommerce' ), $rating ),
|
||||
'attributes' => array(
|
||||
'data-wc-on--click' => "{$this->get_full_block_name()}::actions.removeFilter",
|
||||
'data-wc-context' => "{$this->get_full_block_name()}::" . wp_json_encode( array( 'value' => $rating ), JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP ),
|
||||
'data-wc-on--click' => esc_attr( "{$this->get_full_block_name()}::actions.removeFilter" ),
|
||||
'data-wc-context' => esc_attr( "{$this->get_full_block_name()}::" ) . wp_json_encode( array( 'value' => $rating ), JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP ),
|
||||
),
|
||||
);
|
||||
},
|
||||
|
|
|
@ -129,8 +129,8 @@ class ProductGalleryPager extends AbstractBlock {
|
|||
wp_json_encode(
|
||||
array(
|
||||
'imageId' => strval( $product_gallery_image_id ),
|
||||
JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP,
|
||||
),
|
||||
JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP,
|
||||
)
|
||||
);
|
||||
$p->set_attribute(
|
||||
|
|
Loading…
Reference in New Issue