Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]InternalExecutionError when scanning my setCompetitors method #1336

Closed
andymills opened this issue Jan 31, 2024 · 2 comments
Closed

[BUG]InternalExecutionError when scanning my setCompetitors method #1336

andymills opened this issue Jan 31, 2024 · 2 comments
Labels
BUG P3 Rarely Malfunction duplicate This issue or pull request already exists SFGE Issues related to the Salesforce Graph Engine

Comments

@andymills
Copy link

Description:
Graph Engine identified your source and sink, but you must manually verify that you have a sanitizer in this path. Then, add an engine directive to skip the path. Next, create a Github issue for the Code Analyzer team that includes the error and stack trace. After we fix this issue, check the Code Analyzer release notes for more info. Error and stacktrace: ClassCastException: class com.salesforce.graph.vertex.VariableExpressionVertex$Single cannot be cast to class com.salesforce.graph.vertex.ClassRefExpressionVertex (com.salesforce.graph.vertex.VariableExpressionVertex$Single and com.salesforce.graph.vertex.ClassRefExpressionVertex are in unnamed module of loader 'app'): com.salesforce.graph.symbols.JSONDeserializeFactory.lambda$static$0(JSONDeserializeFactory.java:52);com.salesforce.graph.ops.ApexStandardLibraryUtil.getStandardType(ApexStandardLibraryUtil.java:155);com.salesforce.graph.symbols.PathScopeVisitor.afterVisit(PathScopeVisitor.java:1244);com.salesforce.graph.symbols.DefaultSymbolProviderVertexVisitor.afterVisit(DefaultSymbolProviderVertexVisitor.java:800);com.salesforce.graph.vertex.MethodCallExpressionVertex.afterVisit(MethodCallExpressionVertex.java:79);com.salesforce.graph.ops.expander.ApexPathExpander.performAfterVisit(ApexPathExpander.java:577)

Documentation:
sfge.log

Method code where the error occurs:

 @RemoteAction
    public static string setGuidelines(string id, string guidelinesString) {
        GuidelineList deserializeResults;

        try {
            Type resultType = GuidelineList.class;
            deserializeResults = (GuidelineList)JSON.deserialize(guidelinesString, resultType);
        }
        catch (Exception ex) {
            return 'Invalid data';
        }

        if (
            Schema.sObjectType.Guideline__c.fields.Stroke__c.isAccessible() && 
            Schema.sObjectType.Guideline__c.fields.Colour__c.isAccessible() &&
            Schema.sObjectType.Guideline__c.fields.Name.isAccessible() &&
            Schema.sObjectType.Guideline__c.fields.Opportunity__c.isAccessible() &&
            Schema.sObjectType.Guideline__c.fields.InternalId__c.isAccessible() &&
            Schema.sObjectType.Guideline__c.fields.Pos__c.isAccessible()
       ) {
            List<Guideline__c> guidelines =  [select id, name, Pos__c, InternalId__c, Stroke__c, Colour__c from Guideline__c where Opportunity__c =: id]; 

            addUpdateGuidelines(id, deserializeResults.guidelines, guidelines);
            deleteGuidelines(id, deserializeResults.guidelines, guidelines);
            return 'Success';
       }else{
            return 'No read access';
       }
    }

Steps To Reproduce:
I ran the following scanner:
sf scanner run dfa --format=csv --outfile=CodeAnalyzerDFA.csv --target="./force-app/main/default" --projectdir="./force-app/main/default" --category="Security"

Expected Behavior:
If invalid data is passed in I expect it to return a string 'Invalid data'
If the user has no access then it returns 'no read access'
If everything is okay it returns 'Success'

Desktop:
Provide these details:

  • Operating System: Windows 11
  • Code Analyzer version: v3.20.0
  • Salesforce CLI version: @salesforce/cli/2.23.20 win32-x64 node-v18.19.0

Additional Context:

Workaround:
Tried the directives to exclude from the engine, but it doesn't work
Urgency:
Medium

@johnbelosf johnbelosf added the BUG P3 Rarely Malfunction label Feb 20, 2024
Copy link

git2gus bot commented Feb 20, 2024

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

@stephen-carter-at-sf stephen-carter-at-sf added the SFGE Issues related to the Salesforce Graph Engine label May 23, 2024
@stephen-carter-at-sf stephen-carter-at-sf added the duplicate This issue or pull request already exists label Jun 3, 2024
@stephen-carter-at-sf
Copy link
Collaborator

Marking this as a duplicate of #1497

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BUG P3 Rarely Malfunction duplicate This issue or pull request already exists SFGE Issues related to the Salesforce Graph Engine
Projects
None yet
Development

No branches or pull requests

3 participants