Movatterモバイル変換


[0]ホーム

URL:


 
» Security Edit on GitHub

Security

Rules that flag potential security flaws.
Table of Contents

VfCsrf

Since: PMD 5.6.0

Priority: Medium (3)

Avoid calling VF action upon page load as the action becomes vulnerable to CSRF.

This rule is defined by the following Java class:net.sourceforge.pmd.lang.visualforce.rule.security.VfCsrfRule

Example(s):

<apex:page controller="AcRestActionsController" action="{!csrfInitMethod}" >

Use this rule by referencing it:

<ruleref="category/visualforce/security.xml/VfCsrf"/>

VfHtmlStyleTagXss

Since: PMD 6.31.0

Priority: Medium (3)

Checks for the correct encoding in<style/> tags in Visualforce pages.

The rule is based on Salesforce Security’s recommendation to prevent XSS in Visualforce as mentionedonSecure Coding Cross Site Scripting.

In order to avoid cross site scripting, the relevant encoding must be used in HTML tags. The rule expectsURLENCODING orJSINHTMLENCODING for URL-based style values and any kind of encoding(e.g.HTMLENCODING) for non-url style values.

See alsoVfUnescapeEl to check escaping in other places on Visualforce pages.

This rule is defined by the following Java class:net.sourceforge.pmd.lang.visualforce.rule.security.VfHtmlStyleTagXssRule

Example(s):

<apex:page>    <style>        div {            background: url('{!XSSHere}'); // Potential XSS        }        div {            background: url('{!URLENCODE(XSSHere)}'); // correct encoding        }    </style></apex:page>

Use this rule by referencing it:

<ruleref="category/visualforce/security.xml/VfHtmlStyleTagXss"/>

VfUnescapeEl

Since: PMD 5.6.0

Priority: Medium (3)

Avoid unescaped user controlled content in EL as it results in XSS.

This rule is defined by the following Java class:net.sourceforge.pmd.lang.visualforce.rule.security.VfUnescapeElRule

Example(s):

<apex:outputText value="Potential XSS is {! here }" escape="false" />

Use this rule by referencing it:

<ruleref="category/visualforce/security.xml/VfUnescapeEl"/>

This documentation is written in markdown.
If there is something missing or can be improved, edit this page on github and create a PR: Edit on GitHub

©2026 PMD Open Source Project. All rights reserved.
Site last generated: Jan 30, 2026

PMD                logo


[8]ページ先頭

©2009-2026 Movatter.jp