GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||
GeezerVison is showing github.com — [apex] ApexSOQLInjection: Add support count query by gwilymatgearset · Pull Request #4056 · pmd/pmd Conversation
|
Generated by 🚫 Danger |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
I'm going to merge this now. Please have a look at the one potential problem I've identified with List<String>...
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| <code><![CDATA[ | ||
| public class Foo { | ||
| public void test1(List<String> t1) { | ||
| Database.countQuery('SELECT COUNT() FROM Account ' + string.join(t1, ',')); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I know that this is the same test case as for Database.query, but: Wouldn't that allow injection here? (in both cases)
The list t1 is coming from somewhere unsafe. If the first (and only) entry in the list is e.g. "; DELETE FROM Account" - wouldn't that just be executed? Since in this case the list has only 1 element, it is exactly like a simple concatenation...
Would you mind following up on this? If you agree with my assessment, please create a new issue - so that somebody can fix it for both methods (query, countQuery).
I'd merge this PR as is for now, since it is consistent with the current behavior of the rule. This potential bug should be fixed in a separate PR.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I've managed to inject in that case:
List<string> stuff = new List<string>(); stuff.add('WHERE Name = \'hi\' OR Name = \''); stuff.add('\''); Database.countQuery( 'SELECT COUNT() FROM Account ' + string.join(stuff, ',') );
I'll open an issue and if I have some time in the near future I'll try fixing that one :)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
…jection-detection-in-count-query [apex] ApexSOQLInjection: Add support count query #4056
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.