Skip to content

Commit 221789c

Browse files
committed
Security/Mustache: improve tests
Make sure some tests contain more complex PHP interpolated expressions to ensure this doesn't lead to false positives. Note: as I haven't been able to come up with valid code samples which would confuse the Mustache syntax with PHP interpolated expressions, I have not implemented the use of the `TextStrings::stripEmbeds()` method.
1 parent 341b181 commit 221789c

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

WordPressVIPMinimum/Tests/Security/MustacheUnitTest.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ echo '<a href="{{href}}">{{&data}}</div></a>'; // NOK: data.
2323
<div class="wp-block-group"><!-- wp:heading {"textAlign":"center","style":{"spacing":{"margin":{"top":"0","right":"0","bottom":"var:preset|spacing|medium","left":"0"}}}} --><!-- OK. -->
2424

2525
<?php
26-
echo "<a href='$href'>{{{data}}}</div></a>"; // NOK: data.
26+
echo "<a href='${foo->{$baz}}'>{{{data}}}</div></a>"; // NOK: data.
2727

2828
echo <<<HERE
2929
<script type="text/html" id="tmpl-example">
30-
<a href="$href">{{{data}}}</div></a><!-- NOK: data. -->
30+
<a href="${(href)}">{{{data}}}</div></a><!-- NOK: data. -->
3131
<a href="{{href}}">{{&data}}</div></a><!-- NOK: data. -->
3232
{{=<% %>=}} <!-- NOK: delimiter change -->
3333
</script>

0 commit comments

Comments
 (0)