Skip to content

Update pmd.version to v7.22.0#375

Merged
renovate[bot] merged 1 commit intomasterfrom
renovate/pmd.version
Mar 5, 2026
Merged

Update pmd.version to v7.22.0#375
renovate[bot] merged 1 commit intomasterfrom
renovate/pmd.version

Conversation

@renovate
Copy link
Contributor

@renovate renovate bot commented Mar 5, 2026

This PR contains the following updates:

Package Change Age Confidence
net.sourceforge.pmd:pmd-java (source) 7.21.07.22.0 age confidence
net.sourceforge.pmd:pmd-core (source) 7.21.07.22.0 age confidence

GitHub Vulnerability Alerts

CVE-2026-28338

Summary

PMD's vbhtml and yahtml report formats insert rule violation messages into HTML output without escaping. When PMD analyzes untrusted source code containing crafted string literals, the generated HTML report contains executable JavaScript that runs when opened in a browser.

While the default html format is not affected via rule violation messages (it correctly uses StringEscapeUtils.escapeHtml4()), it has a similar problem when rendering suppressed violations. The user supplied message (the reason for the suppression) was not escaped.

Details

VBHTMLRenderer.java line 71 appends rv.getDescription() directly into HTML:

sb.append("<td><font class=body>").append(rv.getDescription()).append("</font></td>");

YAHTMLRenderer.java lines 196–203 does the same via renderViolationRow():

private String renderViolationRow(String name, String value) {
    return "<tr><td><b>" + name + "</b></td>" + "<td>" + value + "</td></tr>";
}

Called at line 172:

out.print(renderViolationRow("Description:", violation.getDescription()));

The violation message originates from AvoidDuplicateLiteralsRule.java line 91, which embeds raw string literal values via first.toPrintableString(). This calls StringUtil.escapeJava() (line 476–480), which is a Java source escaper — it passes <, >, and & through unchanged because they are printable ASCII (0x20–0x7e).

By contrast, HTMLRenderer.java line 143 properly escapes:

String d = StringEscapeUtils.escapeHtml4(rv.getDescription());

PoC

  1. Create a Java file with 4+ duplicate string literals containing an HTML payload:
public class Exploit {
    String a = "<img src=x onerror=alert(document.domain)>";
    String b = "<img src=x onerror=alert(document.domain)>";
    String c = "<img src=x onerror=alert(document.domain)>";
    String d = "<img src=x onerror=alert(document.domain)>";
}
  1. Run PMD with the vbhtml format:
pmd check -R category/java/errorprone.xml -f vbhtml -d Exploit.java -r report.html
  1. Open report.html in a browser. A JavaScript alert executes showing document.domain.

The generated HTML contains the unescaped tag:

<td><font class=body>The String literal "<img src=x onerror=alert(document.domain)>" appears 4 times in this file</font></td>

Tested and confirmed on PMD 7.22.0-SNAPSHOT (commit bcc646c53d).

Impact

Stored cross-site scripting (XSS). Affects CI/CD pipelines that run PMD with --format vbhtml or --format yahtml on untrusted source code (e.g., pull requests from external contributors) and expose the HTML report as a build artifact. JavaScript executes in the browser context of anyone who opens the report.

Practical impact is limited because vbhtml and yahtml are legacy formats rarely used in practice. The default html format has a similar issue with user messages from suppressed violations.

Fixes

  • See #​6475: [core] Fix stored XSS in VBHTMLRenderer and YAHTMLRenderer

Configuration

📅 Schedule: Branch creation - Between 12:00 AM and 07:59 AM, only on Thursday ( * 0-7 * * 4 ) in timezone Europe/Berlin, Automerge - Between 08:00 AM and 03:59 PM, only on Thursday ( * 8-15 * * 4 ) in timezone Europe/Berlin.

🚦 Automerge: Enabled.

Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about these updates again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate renovate bot force-pushed the renovate/pmd.version branch from f432e61 to 6ed9334 Compare March 5, 2026 11:00
@renovate renovate bot merged commit 2dea221 into master Mar 5, 2026
4 checks passed
@renovate renovate bot deleted the renovate/pmd.version branch March 5, 2026 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants