Repository navigation
SONARJAVA-6383 Fix FP on S2077 when using conditional operators or integer constants - #6388
Luqmansonar wants to merge 1 commit into
Conversation
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Code Review ✅ Approved🟡 Medium risk · The SQL injection rule now treats primitive operands and constant ternaries as safe, so misclassification could suppress warnings for injectable query construction. Reduces S2077 false positives in SQL string concatenation by skipping ternaries whose branches are all non-dynamic and primitive or primitive-wrapper operands like Verification Rules 2/2 met Repos 5 inspectedFunctional validation No results Rules 2 passed 1 not applicable
Broader impact Repos 5 inspectedCross-repo 5 repositories inspected 0 open impacts
Auto-approval Not enabledFor more verification details, comment OptionsAuto-apply is off → Gitar will not commit updates to this branch. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Gitar |
|
asya-vorobeva
left a comment
There was a problem hiding this comment.
Hi! Please take a look at my recent PR #6379 which does almost the same checks for another rule. I think it makes sense to wait for my PR to be merged and after it extract / reuse common functionality.




Fixes two false-positive cases from SONARJAVA-6383:
"... " + (asc ? "ASC" : "DESC")) is no longer reported." OFFSET " + offset) are no longer reported, consistent with the existingString.formathandling.Not addressed:
s + ""(needs symbolic execution per the ticket).Behavior change:
SQLInjection.javaline 190 (int id + " > query_id ") is now compliant instead of noncompliant. Ruling expectations may change; CI will propose updates.🤖 Generated with Claude Code