forcedotcom / sfdx-scanner

MIT License
215 stars 49 forks source link

[BUG] InternalExecutionError: Blob.toString #1627

Closed jaelee125 closed 1 week ago

jaelee125 commented 3 weeks ago

Have you tried to resolve this issue yourself first?

Yes

Bug Description

Scanner run dfa is throwing an error when trying to use Blob.toString method

Output / Logs

"2","3","/Users/jae/code/specright/force-app/main/default/classes/ConfigureMassUpdateController.cls","344","30","ConfigureMassUpdateController","getUpdatedRecords","","","","InternalExecutionError","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: TodoException: MethodCallExpressionVertex{fullMethodName=csvBlob.toString, referenceVertex=LazyVertex{result=ReferenceExpression{properties={FirstChild=true, Names=[csvBlob], BeginLine=365, DefiningType_CaseSafe=configuremassupdatecontroller, LastChild=true, DefiningType=ConfigureMassUpdateController, EndLine=365, Name_CaseSafe=csvblob, childIdx=0, BeginColumn=21, ReferenceType=METHOD, Name=csvBlob}}}, chainedNames=[csvBlob], properties={FirstChild=true, FullMethodName=csvBlob.toString, BeginLine=365, FullMethodName_CaseSafe=csvblob.tostring, DefiningType_CaseSafe=configuremassupdatecontroller, LastChild=false, DefiningType=ConfigureMassUpdateController, EndLine=365, MethodName_CaseSafe=tostring, childIdx=0, BeginColumn=29, MethodName=toString}}: com.salesforce.graph.symbols.apex.schema.SObjectField._applyMethod(SObjectField.java:155);com.salesforce.graph.symbols.apex.schema.SObjectField.apply(SObjectField.java:124);com.salesforce.graph.symbols.PathScopeVisitor.handleApexValueMethod(PathScopeVisitor.java:1487);com.salesforce.graph.symbols.PathScopeVisitor.afterVisit(PathScopeVisitor.java:1242);com.salesforce.graph.symbols.DefaultSymbolProviderVertexVisitor.afterVisit(DefaultSymbolProviderVertexVisitor.java:800);com.salesforce.graph.vertex.MethodCallExpressionVertex.afterVisit(MethodCallExpressionVertex.java:79)","https://developer.salesforce.com/docs/platform/salesforce-code-analyzer/guide/apexflsviolation-rule.html","InternalExecutionError","sfge"

Steps To Reproduce

List contentDocumentLinks = [SELECT ContentDocumentId FROM ContentDocumentLink WHERE LinkedEntityId = :changeRequestId AND ContentDocument.Title = :documentTitle WITH USER_MODE]; ContentVersion contentVersion = [SELECT Id, VersionData FROM ContentVersion WHERE ContentDocumentId = :contentDocumentLinks[0].ContentDocumentId AND IsLatest = true WITH USER_MODE]; Blob csvBlob = contentVersion.VersionData;

Expected Behavior

Error should not be happening on Blob.toString

Operating System

MacOS Sonoma 14.6.1

Salesforce CLI Version

@salesforce/cli/2.58.7 darwin-arm64 node-v20.17.0

Code Analyzer Plugin (@salesforce/sfdx-scanner) Version

@salesforce/sfdx-scanner 4.5.0

Java Version

openjdk 19.0.1 2022-10-18

Additional Context (Screenshots, Files, etc)

No response

Workaround

No response

Urgency

Low

jfeingold35 commented 3 weeks ago

Thanks for bringing this to our attention. We'll add it to our backlog.

git2gus[bot] commented 3 weeks ago

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

stephen-carter-at-sf commented 1 week ago

Duplicate of 1497