Skip to content

SONARJAVA-6745 Implement new rule S9146: Apache XML RPC extensions should not be enabled - #5907

Merged
romainbrenguier merged 3 commits into
masterfrom
new-rule/SONARJAVA-6742-S9146
Aug 11, 2026
Merged

SONARJAVA-6745 Implement new rule S9146: Apache XML RPC extensions should not be enabled#5907
romainbrenguier merged 3 commits into
masterfrom
new-rule/SONARJAVA-6742-S9146

Conversation

@romainbrenguier

Copy link
Copy Markdown
Contributor

Detect calls to setEnabledForExtensions() on Apache XML-RPC configuration objects where the argument is not provably false, as enabling extensions activates Java object deserialization which can lead to remote code execution.

Part of

Detect calls to setEnabledForExtensions() on Apache XML-RPC
configuration objects where the argument is not provably false,
as enabling extensions activates Java object deserialization
which can lead to remote code execution.
@hashicorp-vault-sonar-prod hashicorp-vault-sonar-prod Bot changed the title Implement new rule S9146: Apache XML RPC extensions should not be enabled SONARJAVA-6745 Implement new rule S9146: Apache XML RPC extensions should not be enabled Aug 10, 2026
@hashicorp-vault-sonar-prod

hashicorp-vault-sonar-prod Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

SONARJAVA-6745

romainbrenguier and others added 2 commits August 10, 2026 11:50
…ing type hierarchy

The XmlRpcExtensionsCheck test was failing because:
1. The test sample was in the non-compiling directory but the check uses
   AbstractMethodDetection with MethodMatchers.ofSubTypes(), which requires
   the library types to be on the classpath for resolution.
2. The MethodMatcher used XmlRpcHttpRequestConfigImpl as the parent type,
   but XmlRpcServerConfigImpl does not extend it - both extend XmlRpcConfigImpl.

Fix: Add xmlrpc-client and xmlrpc-server dependencies, move the test sample
to the compiling location, and use XmlRpcConfigImpl as the correct parent type.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Only report when the argument is provably true instead of when it is
not provably false.  This avoids false positives for runtime-computed
values that may legitimately be false.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sonarqube-next

Copy link
Copy Markdown

@romainbrenguier
romainbrenguier marked this pull request as ready for review August 11, 2026 07:14

@rombirli rombirli left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great impl

@romainbrenguier
romainbrenguier merged commit 07e29f8 into master Aug 11, 2026
18 checks passed
@romainbrenguier
romainbrenguier deleted the new-rule/SONARJAVA-6742-S9146 branch August 11, 2026 12:12
@gitar-bot

gitar-bot Bot commented Aug 11, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 1 resolved / 1 findings

Implements new rule S9146 to detect insecure Apache XML-RPC extension enablement, addressing the vulnerability reports for unknown boolean arguments. No issues found.

✅ 1 resolved
Edge Case: Rule reports as VULNERABILITY for unknown boolean arguments

📄 java-checks/src/main/java/org/sonar/java/checks/security/XmlRpcExtensionsCheck.java:40-43 📄 java-checks-test-sources/default/src/main/files/non-compiling/checks/security/XmlRpcExtensionsCheckSample.java:33-36
The check flags any argument that is not provably Boolean.FALSE, including runtime-computed values (e.g. setEnabledForExtensions(enable)). Since the rule type is VULNERABILITY (not a Security Hotspot), this can produce false positives in code that legitimately passes a boolean that is false at runtime but not resolvable as a compile-time constant. This is intentional per the test samples, but consider whether such unresolvable cases warrant a Security Hotspot classification or a distinct message to reduce noise.

Implementation Status ✅ 1 / 1 issues implemented
SONARJAVA-6742 — 1 / 1 objectives

The PR implements the new rule S9146 to check that Apache XML RPC extensions are not enabled.

✅ 1 complete
  • ✅ Implement new rule S9146: Apache XML RPC extensions should not be enabled
Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing less information.

Comment with these commands to change the behavior for this request:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

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.

2 participants