Repository navigation
[apex] Report SOQL injection violations at query calls - #7268
Open
Gabrieljr42 wants to merge 1 commit into
Open
Gabrieljr42 wants to merge 1 commit into
Gabrieljr42 wants to merge 1 commit into
Conversation
Gabrieljr42
marked this pull request as ready for review
October 31, 2026 00:06
Contributor
|
Compared to main: (comment created at 2026-10-31 00:22:37+00:00 for 6c7dcca) |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe the PR
ApexSOQLInjection currently reports an unsafe variable inside a query, so a multiline query can be reported on its last line. Report both concatenated queries and query variables at the matching
Database.queryorDatabase.countQuerycall instead. The detection conditions and number of violations are preserved.Adds regression cases for the original wrapped multiline query, multiline
countQuerywith multiple unsafe variables, query arguments on later lines, single-line queries, and sanitized queries. Also adds the fixed-issue release note.Related issues
Validation
e08cc0e): the new cases produced three expected location failures; the original example reported line 6 instead of line 3../mvnw -pl pmd-apex -am -Dtest=ApexSOQLInjectionTest -Dsurefire.failIfNoSpecifiedTests=false test: 59 tests passed../mvnw -pl pmd-apex -am verify: passed on JDK 25, including Checkstyle, API compatibility, and documentation generation. 7,946 tests run, no failures or errors, 9 skipped.Ready?
./mvnw clean verifypasses (checked automatically by GitHub Actions)I used AI assistance for the implementation and tests.