GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [visualforce] False positive on VfUnescapeEl with new Message Channel feature · Issue #2620 · pmd/pmd

[visualforce] False positive on VfUnescapeEl with new Message Channel feature #2620

New issue
Copy link
New issue
Copy link
Closed
#2638
#2621
Closed
[visualforce] False positive on VfUnescapeEl with new Message Channel feature#2620
#2638
#2621
Copy link
Labels
a:false-positivePMD flags a piece of code that is not problematic
Milestone
6.26.0

Description

@pchittum
pchittum
opened on Jun 30, 2020
Issue body actions

Affects PMD Version:
6.25.0

Rule:
VfUnescapeEl

Description:
There's a new feature called Lightning Message Service that is surfaced through a global variable $MessageChannel. The only way to access it is to bind to it in Visualforce markup.

This produces a false positive when PMD encounters this, as there's no reason to escape this content. It could never be entered by a user.

Docs: https://developer.salesforce.com/docs/atlas.en-us.222.0.pages.meta/pages/pages_variables_global_messagechannel.htm and https://developer.salesforce.com/docs/atlas.en-us.222.0.pages.meta/pages/message_channel_intro.htm

Code Sample demonstrating the issue:

    <script type="text/javascript">
        // Binding message channel to variable accessible to static resource.
        window.util = {
            messageChannel: '{!$MessageChannel.Record_Selected__c}'
        };
    </script>

Expected outcome:

This usage should produce no rule violations with PMD. I believe it should be included in the list of safe global variable found here:

pmd/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/rule/security/VfUnescapeElRule.java

Lines 290 to 298 in 596f27b

switch (lowerCaseId) {
case "$action":
case "$page":
case "$site":
case "$resource":
case "$label":
case "$objecttype":
case "$component":
case "$remoteaction":

Running PMD through: [CLI | Ant | Maven | Gradle | Designer | Other]
Other

Activity

  1. pchittum
    added
    a:bugPMD crashes or fails to analyse a file.
    on Jun 30, 2020
  2. pchittum
    changed the title [-][apex] False positive on VfUnescapeEl with new Message Channel feature[/-] [+][visualforce] False positive on VfUnescapeEl with new Message Channel feature[/+] on Jun 30, 2020
  3. rsoesemann
    closed this as completedin #2621on Jun 30, 2020
  4. adangel commented on Jun 30, 2020

    @adangel
    adangel
    on Jun 30, 2020
    Member
    More actions

    PR #2621 was reverted via #2623 , so reopen.

  5. adangel
    reopened this on Jun 30, 2020
  6. adangel
    added
    a:false-positivePMD flags a piece of code that is not problematic
    and removed
    a:bugPMD crashes or fails to analyse a file.
    on Jul 2, 2020
  7. adangel
    added this to the 6.26.0 milestone on Jul 9, 2020
  8. adangel
    closed this as completedin #2638on Jul 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    a:false-positivePMD flags a piece of code that is not problematic

    Type

    No type

    Projects

    No projects

      Milestone

      • 6.26.0

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.