Skip to content

Commit efacebe

Browse files
authored
Merge pull request #683 from Automattic/develop
Release 2.3.2
2 parents 90173ce + 086b3da commit efacebe

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [2.3.2] - 2021-04-28
8+
9+
Props: jrfnl
10+
11+
### Fixed
12+
- [#681](https://github.com/Automattic/VIP-Coding-Standards/pull/681): ProperEscapingFunction: improve attribute matching accuracy for notAttrEscAttr.
13+
714
## [2.3.1] - 2021-04-23
815

916
Props: jrfnl
@@ -550,6 +557,7 @@ Initial release.
550557
Props: david-binda, pkevan.
551558

552559

560+
[2.3.2]: https://github.com/Automattic/VIP-Coding-Standards/compare/2.3.1...2.3.2
553561
[2.3.1]: https://github.com/Automattic/VIP-Coding-Standards/compare/2.3.0...2.3.1
554562
[2.3.0]: https://github.com/Automattic/VIP-Coding-Standards/compare/2.2.0...2.3.0
555563
[2.2.0]: https://github.com/Automattic/VIP-Coding-Standards/compare/2.1.0...2.2.0

WordPressVIPMinimum/Sniffs/Security/ProperEscapingFunctionSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class ProperEscapingFunctionSniff extends Sniff {
2323
*
2424
* @var string
2525
*/
26-
const ATTR_END_REGEX = '`(?<attrname>href|src|url|(^|\s+)action)?=(?:\\\\)?["\']*$`i';
26+
const ATTR_END_REGEX = '`(?<attrname>href|src|url|(^|\s+)action)?(?<=[a-z0-9_-])=(?:\\\\)?["\']*$`i';
2727

2828
/**
2929
* List of escaping functions which are being tested.

WordPressVIPMinimum/Tests/Security/ProperEscapingFunctionUnitTest.inc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,3 +106,10 @@ echo '<a href="', esc_html($url), '">'; // Error.
106106
<div>html</div>
107107
<?= '<h1 class="', esc_attr( $test ), '">'; ?><!-- OK -->
108108
<div>html</div>
109+
110+
// Issue #680 - only match = when preceeded by something which could be an HTML attribute.
111+
<option value="<?php echo esc_attr( $i ); ?>" <?php echo ( $filter_importance === $i ) ? 'selected' : ''; ?> >
112+
&gt;=<?php echo esc_html( $i ); ?>
113+
</option>
114+
115+
<A HREF="<?= esc_url($url) ?>" data-num2=<?= esc_attr( $num2 )><?php echo esc_html( $link ); ?><a/>

0 commit comments

Comments
 (0)