forcedotcom / sfdx-scanner

MIT License
217 stars 50 forks source link

[BUG] UnexpectedException: Query should have fields: Id NOT IN (INNER_QUERY) AND Phone LIKE : contactPhone: #1224

Open MassiBar opened 1 year ago

MassiBar commented 1 year ago

Describe the bug Error running the command: sfdx scanner:run:dfa --target="./IFMAccountsContactManager.cls" --projectdir="./" --category="Security" Error and stacktrace: UnexpectedException: Query should have fields: Id NOT IN (INNER_QUERY) AND Phone LIKE : contactPhone: com.salesforce.graph.ops.SoqlParserUtil.extractFields(SoqlParserUtil.java:333); com.salesforce.graph.ops.SoqlParserUtil.parseFields(SoqlParserUtil.java:356); com.salesforce.graph.ops.SoqlParserUtil.getSoqlQueryInfo(SoqlParserUtil.java:211); com.salesforce.graph.ops.SoqlParserUtil.getInnerQueries(SoqlParserUtil.java:194); com.salesforce.graph.ops.SoqlParserUtil.getInnerQueries(SoqlParserUtil.java:185); com.salesforce.graph.ops.SoqlParserUtil.parseQuery(SoqlParserUtil.java:144)

To Reproduce The following function is causing the error: private static Integer getNumOfAccountElements(String contactPhone) { Integer accs; accs = [SELECT COUNT() FROM Account WHERE (Id NOT IN (SELECT AccountId FROM Contact) AND Phone LIKE : contactPhone) WITH USER_MODE ]; return accs; }

Desktop (please complete the following information):

Additional context "Urgency": "Not business-stopping".

git2gus[bot] commented 9 months ago

This issue has been linked to a new work item: W-15080490