Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into build
Browse files Browse the repository at this point in the history
  • Loading branch information
Miguel Axcar committed Dec 7, 2023
2 parents 1ddf4bd + 6931d5a commit e56a031
Show file tree
Hide file tree
Showing 9 changed files with 8,949 additions and 7,396 deletions.
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v12.22.8
v12
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ The script will sync the the build branch with main, build assets and commit the

## Changelog

### v1.7.2

* Upgraded dependencies for enhanced performance, security and stability.
* Audit fix dependency upgrade, improving code security.
* Enhanced security by introducing sanitization for `post.title.rendered` mitigating XSS attack risks.

### v1.7.1

* Add filter for minimum search length for term select.
Expand Down
89 changes: 49 additions & 40 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions js/post-select/components/post-list-item.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import classNames from 'classnames';
import DOMPurify from 'dompurify';
import moment from 'moment';
import PropTypes from 'prop-types';
import React from 'react';
Expand All @@ -14,7 +15,7 @@ const PostListItem = ( { post, author, thumbnail, postTypeObject, isSelected, on
<label htmlFor={ `select-post-${post.id}` }>
{ thumbnail
? <img
alt={ post.title.rendered }
alt={ DOMPurify.sanitize( post.title.rendered ) }
className="post-list-item--image"
src={ thumbnail.media_details.sizes.thumbnail.source_url }
/>
Expand All @@ -27,7 +28,7 @@ const PostListItem = ( { post, author, thumbnail, postTypeObject, isSelected, on
type="checkbox"
onChange={ () => onToggleSelected() }
/>
<h2 dangerouslySetInnerHTML={ { __html: post.title.rendered } } />
<h2 dangerouslySetInnerHTML={ { __html: DOMPurify.sanitize( post.title.rendered ) } } />
<div className="post-list-item--meta">
{ postTypeObject && ( <span><b>{ __( 'Type:', 'hm-gb-tools' ) }</b> { postTypeObject.labels.singular_name }</span> ) }
<span><b>{ __( 'Status:', 'hm-gb-tools' ) }</b> { post.status }</span>
Expand Down
5 changes: 3 additions & 2 deletions js/post-select/components/selection-item.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import classNames from 'classnames';
import DOMPurify from 'dompurify';
import moment from 'moment';
import PropTypes from 'prop-types';
import React, { Fragment } from 'react';
Expand All @@ -18,13 +19,13 @@ const SelectionListItem = ( { post, thumbnail, author, postTypeObject, isSelecte
<Fragment>
{ thumbnail
? <img
alt={ post.title.rendered }
alt={ DOMPurify.sanitize( post.title.rendered ) }
className="post-list-item--image"
src={ thumbnail.media_details.sizes.thumbnail.source_url }
/>
: '' }
<div className="post-list-item--inner">
<h2 dangerouslySetInnerHTML={ { __html: post.title.rendered } } />
<h2 dangerouslySetInnerHTML={ { __html: DOMPurify.sanitize( post.title.rendered ) } } />
<div className="post-list-item--meta">
{ postTypeObject && ( <span><b>{ __( 'Type:', 'hm-gb-tools' ) }</b> { postTypeObject.labels.singular_name }</span> ) }
<span><b>{ __( 'Status:', 'hm-gb-tools' ) }</b> { post.status }</span>
Expand Down
2 changes: 1 addition & 1 deletion js/post-select/containers/browse.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* global wp */

import _isEqual from 'lodash/isequal';
import _isEqual from 'lodash/isEqual';
import PropTypes from 'prop-types';
import React from 'react';

Expand Down
Loading

0 comments on commit e56a031

Please sign in to comment.