[SONARJAVA-6484] Implement new rule S8899#5684
Conversation
There was a problem hiding this comment.
This should be a separate PR
1ce8a49 to
d42ffb2
Compare
0cec425 to
63869c9
Compare
This rule detects a critical security vulnerability where HTTP request paths
are used in security checks without normalizing multiple consecutive slashes.
Attackers can bypass authentication and authorization by inserting extra slashes
in URLs (e.g., //admin instead of /admin). The rule flags path-based security
checks that lack proper normalization via replaceAll("/+", "/") and applies to
both javax.servlet and jakarta.servlet frameworks, as well as JAX-RS UriInfo.
…e 90% quality gate threshold
…actual test results
f5270aa to
91015a6
Compare
# Conflicts: # its/autoscan/src/test/resources/autoscan/autoscan-diff-by-rules.json # sonar-java-plugin/src/main/resources/org/sonar/l10n/java/rules/java/Sonar_way_profile.json
alex-meseldzija-sonarsource
left a comment
There was a problem hiding this comment.
This rule is useful, but it is a security rule.
I think this means we need to get sign off/reviews from the security domain.
WDYT?
This makes sense. I'll #ask-security-domain |
# Conflicts: # sonar-java-plugin/src/test/java/org/sonar/plugins/java/JavaAgenticWayProfileTest.java
Code Review ✅ Approved 11 resolved / 11 findingsImplements Sonar rule S8899 to detect unnormalized HTTP request paths in security checks, resolving all identified implementation gaps including regex mismatches, dead code, and inaccurate path detection logic. ✅ 11 resolved✅ Quality: Unrelated local tooling/config files committed in this PR
✅ Edge Case: Over-broad security-context detection causes many false positives
✅ Edge Case: Normalization detection too narrow; misses common forms
✅ Quality: Dead state: normalizedVariables set is written but never read
✅ Quality: Internal AI analysis doc committed to repo
...and 6 more resolved from earlier reviews OptionsAuto-apply is off → Gitar will not commit updates to this branch. Comment with these commands to change:
Was this helpful? React with 👍 / 👎 | Gitar |
# Conflicts: # sonar-java-plugin/src/test/java/org/sonar/plugins/java/JavaAgenticWayProfileTest.java
…est from 468 to 467 after a merge conflict resolution error (master removed S6548 from the agentic profile while our branch added S8899, net result is 467 not 468)
|
|
I'm withdrawing this rule for now, since it falls under the security domain. |




This rule detects a critical security vulnerability where HTTP request paths are used in security checks without normalizing multiple consecutive slashes. Attackers can bypass authentication and authorization by inserting extra slashes in URLs (e.g., //admin instead of /admin). The rule flags path-based security checks that lack proper normalization via replaceAll("/+", "/") and applies to both javax.servlet and jakarta.servlet frameworks, as well as JAX-RS UriInfo.
Part of
Summary by Gitar
S8899to detect unnormalized HTTP request paths in security checks..cursor/rules/sonar_code_context.mdcand.sonar-code-context/settings.jsonto manage development quality standards..gitignoreto track critical Sonar configuration while excluding transient files.java-S8899.jsontracking files to multiple test projects inits/ruling/.updatePathStateFromMethodInvocationhelper withinRequestPathNormalizationCheck.java.mise.tomlto lock Java to version21.Sonar_agentic_AI_profile.jsonandSonar_way_profile.jsonand adjustedAutoScanTestexpectations.This will update automatically on new commits.