forked from phoedos/pmd
Fallback for JS arrays and defs
This commit is contained in:
@ -94,6 +94,10 @@ public class VfUnescapeElRule extends AbstractVfRule {
|
||||
private boolean isUnbalanced(String image, String pattern) {
|
||||
int occurance = 0;
|
||||
int index = image.indexOf("=");
|
||||
if (index < 0) {
|
||||
index = image.indexOf(":");
|
||||
}
|
||||
|
||||
index = image.indexOf(pattern, index + 1);
|
||||
while (index >= 0) {
|
||||
occurance++;
|
||||
@ -227,6 +231,8 @@ public class VfUnescapeElRule extends AbstractVfRule {
|
||||
case "$site":
|
||||
case "$page":
|
||||
case "$action":
|
||||
case "casesafeid":
|
||||
case "$remoteaction":
|
||||
return true;
|
||||
|
||||
}
|
||||
|
@ -3,7 +3,27 @@
|
||||
|
||||
<test-code>
|
||||
<description><![CDATA[
|
||||
No XSS in safe commands quoted context
|
||||
Safe escaped value in repeat
|
||||
]]></description>
|
||||
<expected-problems>0</expected-problems>
|
||||
<code><![CDATA[
|
||||
<apex:page>
|
||||
<apex:repeat value="{!emailTemplates}" var="template">
|
||||
emailTemplates.push({
|
||||
id: '{!template.id}',
|
||||
name: "{!JSENCODE(HTMLENCODE(template.name))}"
|
||||
});
|
||||
</apex:repeat>
|
||||
</apex:page>
|
||||
]]></code>
|
||||
<source-type>vf</source-type>
|
||||
</test-code>
|
||||
|
||||
|
||||
|
||||
<test-code>
|
||||
<description><![CDATA[
|
||||
Safe case id in script
|
||||
]]></description>
|
||||
<expected-problems>0</expected-problems>
|
||||
<code><![CDATA[
|
||||
@ -19,7 +39,7 @@ No XSS in safe commands quoted context
|
||||
|
||||
<test-code>
|
||||
<description><![CDATA[
|
||||
No XSS in safe commands quoted context
|
||||
No XSS in safe script commands quoted context
|
||||
]]></description>
|
||||
<expected-problems>0</expected-problems>
|
||||
<code><![CDATA[
|
||||
|
Reference in New Issue
Block a user