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] 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: UnexpectedException: Undefined variable. #1625

Open
JayMalde opened this issue Sep 14, 2024 · 1 comment

Comments

@JayMalde
Copy link

Have you tried to resolve this issue yourself first?

Yes

Bug Description

After I running PMD DFA command it is giving the below message.

"3","3","C:\AOB\AOBPaymentsCCIPackage\AOBPayStripeSepScratch\force-app\main\default\classes\UIController.cls","1705","26","UIController","updateGatewayKeys","","","","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: UnexpectedException: Undefined variable. this=ClassStaticScope{userClass=UserClass{properties={BeginLine=6, DefiningType_CaseSafe=uicontroller, DefiningType=UIController, EndLine=6, FileName=C:\AOB\AOBPaymentsCCIPackage\AOBPayStripeSepScratch\force-app\main\default\classes\UIController.cls, Name_CaseSafe=uicontroller, BeginColumn=27, Name=UIController}}} ClassStaticScope{, methodParametersStack=[MethodInvocationScope{invocableWithParameters=null, apexValues={gatewayId=(Parameter{properties={FirstChild=false, BeginLine=1705, Type=String, DefiningType_CaseSafe=uicontroller, LastChild=false, DefiningType=UIController, EndLine=1705, Name_CaseSafe=gatewayid, childIdx=1, BeginColumn=51, Name=gatewayId}},ApexStringValue{ value=Optional.empty} ApexValue(ApexStringValue) {status=INDETERMINANT, declarationVertex=Parameter{properties={FirstChild=false, BeginLine=1705, Type=String, DefiningType_CaseSafe=uicontroller, LastChild=false, DefiningType=UIController, EndLine=1705, Name_CaseSafe=gatewayid, childIdx=1, BeginColumn=51, Name=gatewayId}}, valueVertex=null, resolvedValues={}, returnedFrom=null, invocableExpression=null, method=null}), publicKey=(Parameter{properties={FirstChild=false, BeginLine=1705, Type=String, DefiningType_CaseSafe=uicontroller, LastChild=false, DefiningType=UIController, EndLine=1705, Name_CaseSafe=publickey, childIdx=2, BeginColumn=68, Name=publicKey}},ApexStringValue{ value=Optional.empty} ApexValue(ApexStringValue) {status=INDETERMINANT, declarationVertex=Parameter{properties={FirstChild=false, BeginLine=1705, Type=String, DefiningType_CaseSafe=uicontroller, LastChild=false, DefiningType=UIController, EndLine=1705, Name_CaseSafe=publickey, childIdx=2, BeginColumn=68, Name=publicKey}}, valueVertex=null, resolvedValues={}, returnedFrom=null, invocableExpression=null, method=null}), secretKey=(Parameter{properties={FirstChild=false, BeginLine=1705, Type=String, DefiningType_CaseSafe=uicontroller, LastChild=false, DefiningType=UIController, EndLine=1705, Name_CaseSafe=secretkey, childIdx=3, BeginColumn=86, Name=secretKey}},ApexStringValue{ value=Optional.empty} ApexValue(ApexStringValue) {status=INDETERMINANT, declarationVertex=Parameter{properties={FirstChild=false, BeginLine=1705, Type=String, DefiningType_CaseSafe=uicontroller, LastChild=false, DefiningType=UIController, EndLine=1705, Name_CaseSafe=secretkey, childIdx=3, BeginColumn=86, Name=secretKey}}, valueVertex=null, resolvedValues={}, returnedFrom=null, invocableExpression=null, method=null})}, returnedApexValue=null} com.salesforce.graph.symbols.MethodInvocationScope@1c473a7d]}, key=Secret_Key__c, value=ApexStringValue{ value=Optional.empty} ApexValue(ApexStringValue) {status=INDETERMINANT, declarationVertex=ApexStringValue{ value=Optional.empty} ApexValue(ApexStringValue) {status=INDETERMINANT, declarationVertex=VariableDeclaration{properties={FirstChild=false, BeginLine=335, Type=String, DefiningType_CaseSafe=utility, LastChild=true, DefiningType=Utility, EndLine=335, Name_CaseSafe=encryptedstring, childIdx=1, BeginColumn=16, Name=encryptedString}}, valueVertex=MethodCallExpressionVertex{fullMethodName=EncodingUtil.base64Encode, referenceVertex=LazyVertex{result=ReferenceExpression{properties={FirstChild=true, Names=[EncodingUtil], BeginLine=335, DefiningType_CaseSafe=utility, LastChild=false, DefiningType=Utility, EndLine=335, Name_CaseSafe=encodingutil, childIdx=0, BeginColumn=34, ReferenceType=METHOD, Name=EncodingUtil}}}, chainedNames=[EncodingUtil], properties={FirstChild=true, FullMethodName=EncodingUtil.base64Encode, BeginLine=335, FullMethodName_CaseSafe=encodingutil.base64encode, DefiningType_CaseSafe=utility, LastChild=false, DefiningType=Utility, EndLine=335, MethodName_CaseSafe=base64encode, childIdx=0, BeginColumn=47, MethodName=base64Encode}}, resolvedValues={VariableExpression{properties={FirstChild=false, BeginLine=335, DefiningType_CaseSafe=utility, LastChild=true, DefiningType=Utility, EndLine=335, Name_CaseSafe=encrypted, childIdx=1, BeginColumn=60, Name=encrypted}}=MethodCallExpressionVertex{fullMethodName=Crypto.encryptWithManagedIV, referenceVertex=LazyVertex{result=ReferenceExpression{properties={FirstChild=true, Names=[Crypto], BeginLine=334, DefiningType_CaseSafe=utility, LastChild=false, DefiningType=Utility, EndLine=334, Name_CaseSafe=crypto, childIdx=0, BeginColumn=26, ReferenceType=METHOD, Name=Crypto}}}, chainedNames=[Crypto], properties={FirstChild=true, FullMethodName=Crypto.encryptWithManagedIV, BeginLine=334, FullMethodName_CaseSafe=crypto.encryptwithmanagediv, DefiningType_CaseSafe=utility, LastChild=false, DefiningType=Utility, EndLine=334, MethodName_CaseSafe=encryptwithmanagediv, childIdx=0, BeginColumn=33, MethodName=encryptWithManagedIV}}}, returnedFrom=null, invocableExpression=null, method=null}, valueVertex=MethodCallExpressionVertex{fullMethodName=EncodingUtil.base64Encode, referenceVertex=LazyVertex{result=ReferenceExpression{properties={FirstChild=true, Names=[EncodingUtil], BeginLine=335, DefiningType_CaseSafe=utility, LastChild=false, DefiningType=Utility, EndLine=335, Name_CaseSafe=encodingutil, childIdx=0, BeginColumn=34, ReferenceType=METHOD, Name=EncodingUtil}}}, chainedNames=[EncodingUtil], properties={FirstChild=true, FullMethodName=EncodingUtil.base64Encode, BeginLine=335, FullMethodName_CaseSafe=encodingutil.base64encode, DefiningType_CaseSafe=utility, LastChild=false, DefiningType=Utility, EndLine=335, MethodName_CaseSafe=base64encode, childIdx=0, BeginColumn=47, MethodName=base64Encode}}, resolvedValues={VariableExpression{properties={FirstChild=false, BeginLine=335, DefiningType_CaseSafe=utility, LastChild=true, DefiningType=Utility, EndLine=335, Name_CaseSafe=encrypted, childIdx=1, BeginColumn=60, Name=encrypted}}=MethodCallExpressionVertex{fullMethodName=Crypto.encryptWithManagedIV, referenceVertex=LazyVertex{result=ReferenceExpression{properties={FirstChild=true, Names=[Crypto], BeginLine=334, DefiningType_CaseSafe=utility, LastChild=false, DefiningType=Utility, EndLine=334, Name_CaseSafe=crypto, childIdx=0, BeginColumn=26, ReferenceType=METHOD, Name=Crypto}}}, chainedNames=[Crypto], properties={FirstChild=true, FullMethodName=Crypto.encryptWithManagedIV, BeginLine=334, FullMethodName_CaseSafe=crypto.encryptwithmanagediv, DefiningType_CaseSafe=utility, LastChild=false, DefiningType=Utility, EndLine=334, MethodName_CaseSafe=encryptwithmanagediv, childIdx=0, BeginColumn=33, MethodName=encryptWithManagedIV}}}, returnedFrom=null, invocableExpression=null, method=null}: com.salesforce.graph.symbols.PathScopeVisitor.updateVariable(PathScopeVisitor.java:192);com.salesforce.graph.symbols.ClassStaticScope.updateVariable(ClassStaticScope.java:76);com.salesforce.graph.symbols.PathScopeVisitor.updateVariable(PathScopeVisitor.java:190);com.salesforce.graph.symbols.PathScopeVisitor.updateVariable(PathScopeVisitor.java:190);com.salesforce.graph.symbols.PathScopeVisitor.updateVariable(PathScopeVisitor.java:190);com.salesforce.graph.symbols.PathScopeVisitor.updateVariable(PathScopeVisitor.java:190)","https://developer.salesforce.com/docs/platform/salesforce-code-analyzer/guide/apexflsviolation-rule.html","InternalExecutionError","sfge"

Output / Logs

"3","3","C:\AOB\AOBPaymentsCCIPackage\AOBPayStripeSepScratch\force-app\main\default\classes\UIController.cls","1705","26","UIController","updateGatewayKeys","","","","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: UnexpectedException: Undefined variable. this=ClassStaticScope{userClass=UserClass{properties={BeginLine=6, DefiningType_CaseSafe=uicontroller, DefiningType=UIController, EndLine=6, FileName=C:\AOB\AOBPaymentsCCIPackage\AOBPayStripeSepScratch\force-app\main\default\classes\UIController.cls, Name_CaseSafe=uicontroller, BeginColumn=27, Name=UIController}}} ClassStaticScope{, methodParametersStack=[MethodInvocationScope{invocableWithParameters=null, apexValues={gatewayId=(Parameter{properties={FirstChild=false, BeginLine=1705, Type=String, DefiningType_CaseSafe=uicontroller, LastChild=false, DefiningType=UIController, EndLine=1705, Name_CaseSafe=gatewayid, childIdx=1, BeginColumn=51, Name=gatewayId}},ApexStringValue{ value=Optional.empty} ApexValue(ApexStringValue) {status=INDETERMINANT, declarationVertex=Parameter{properties={FirstChild=false, BeginLine=1705, Type=String, DefiningType_CaseSafe=uicontroller, LastChild=false, DefiningType=UIController, EndLine=1705, Name_CaseSafe=gatewayid, childIdx=1, BeginColumn=51, Name=gatewayId}}, valueVertex=null, resolvedValues={}, returnedFrom=null, invocableExpression=null, method=null}), publicKey=(Parameter{properties={FirstChild=false, BeginLine=1705, Type=String, DefiningType_CaseSafe=uicontroller, LastChild=false, DefiningType=UIController, EndLine=1705, Name_CaseSafe=publickey, childIdx=2, BeginColumn=68, Name=publicKey}},ApexStringValue{ value=Optional.empty} ApexValue(ApexStringValue) {status=INDETERMINANT, declarationVertex=Parameter{properties={FirstChild=false, BeginLine=1705, Type=String, DefiningType_CaseSafe=uicontroller, LastChild=false, DefiningType=UIController, EndLine=1705, Name_CaseSafe=publickey, childIdx=2, BeginColumn=68, Name=publicKey}}, valueVertex=null, resolvedValues={}, returnedFrom=null, invocableExpression=null, method=null}), secretKey=(Parameter{properties={FirstChild=false, BeginLine=1705, Type=String, DefiningType_CaseSafe=uicontroller, LastChild=false, DefiningType=UIController, EndLine=1705, Name_CaseSafe=secretkey, childIdx=3, BeginColumn=86, Name=secretKey}},ApexStringValue{ value=Optional.empty} ApexValue(ApexStringValue) {status=INDETERMINANT, declarationVertex=Parameter{properties={FirstChild=false, BeginLine=1705, Type=String, DefiningType_CaseSafe=uicontroller, LastChild=false, DefiningType=UIController, EndLine=1705, Name_CaseSafe=secretkey, childIdx=3, BeginColumn=86, Name=secretKey}}, valueVertex=null, resolvedValues={}, returnedFrom=null, invocableExpression=null, method=null})}, returnedApexValue=null} com.salesforce.graph.symbols.MethodInvocationScope@1c473a7d]}, key=Secret_Key__c, value=ApexStringValue{ value=Optional.empty} ApexValue(ApexStringValue) {status=INDETERMINANT, declarationVertex=ApexStringValue{ value=Optional.empty} ApexValue(ApexStringValue) {status=INDETERMINANT, declarationVertex=VariableDeclaration{properties={FirstChild=false, BeginLine=335, Type=String, DefiningType_CaseSafe=utility, LastChild=true, DefiningType=Utility, EndLine=335, Name_CaseSafe=encryptedstring, childIdx=1, BeginColumn=16, Name=encryptedString}}, valueVertex=MethodCallExpressionVertex{fullMethodName=EncodingUtil.base64Encode, referenceVertex=LazyVertex{result=ReferenceExpression{properties={FirstChild=true, Names=[EncodingUtil], BeginLine=335, DefiningType_CaseSafe=utility, LastChild=false, DefiningType=Utility, EndLine=335, Name_CaseSafe=encodingutil, childIdx=0, BeginColumn=34, ReferenceType=METHOD, Name=EncodingUtil}}}, chainedNames=[EncodingUtil], properties={FirstChild=true, FullMethodName=EncodingUtil.base64Encode, BeginLine=335, FullMethodName_CaseSafe=encodingutil.base64encode, DefiningType_CaseSafe=utility, LastChild=false, DefiningType=Utility, EndLine=335, MethodName_CaseSafe=base64encode, childIdx=0, BeginColumn=47, MethodName=base64Encode}}, resolvedValues={VariableExpression{properties={FirstChild=false, BeginLine=335, DefiningType_CaseSafe=utility, LastChild=true, DefiningType=Utility, EndLine=335, Name_CaseSafe=encrypted, childIdx=1, BeginColumn=60, Name=encrypted}}=MethodCallExpressionVertex{fullMethodName=Crypto.encryptWithManagedIV, referenceVertex=LazyVertex{result=ReferenceExpression{properties={FirstChild=true, Names=[Crypto], BeginLine=334, DefiningType_CaseSafe=utility, LastChild=false, DefiningType=Utility, EndLine=334, Name_CaseSafe=crypto, childIdx=0, BeginColumn=26, ReferenceType=METHOD, Name=Crypto}}}, chainedNames=[Crypto], properties={FirstChild=true, FullMethodName=Crypto.encryptWithManagedIV, BeginLine=334, FullMethodName_CaseSafe=crypto.encryptwithmanagediv, DefiningType_CaseSafe=utility, LastChild=false, DefiningType=Utility, EndLine=334, MethodName_CaseSafe=encryptwithmanagediv, childIdx=0, BeginColumn=33, MethodName=encryptWithManagedIV}}}, returnedFrom=null, invocableExpression=null, method=null}, valueVertex=MethodCallExpressionVertex{fullMethodName=EncodingUtil.base64Encode, referenceVertex=LazyVertex{result=ReferenceExpression{properties={FirstChild=true, Names=[EncodingUtil], BeginLine=335, DefiningType_CaseSafe=utility, LastChild=false, DefiningType=Utility, EndLine=335, Name_CaseSafe=encodingutil, childIdx=0, BeginColumn=34, ReferenceType=METHOD, Name=EncodingUtil}}}, chainedNames=[EncodingUtil], properties={FirstChild=true, FullMethodName=EncodingUtil.base64Encode, BeginLine=335, FullMethodName_CaseSafe=encodingutil.base64encode, DefiningType_CaseSafe=utility, LastChild=false, DefiningType=Utility, EndLine=335, MethodName_CaseSafe=base64encode, childIdx=0, BeginColumn=47, MethodName=base64Encode}}, resolvedValues={VariableExpression{properties={FirstChild=false, BeginLine=335, DefiningType_CaseSafe=utility, LastChild=true, DefiningType=Utility, EndLine=335, Name_CaseSafe=encrypted, childIdx=1, BeginColumn=60, Name=encrypted}}=MethodCallExpressionVertex{fullMethodName=Crypto.encryptWithManagedIV, referenceVertex=LazyVertex{result=ReferenceExpression{properties={FirstChild=true, Names=[Crypto], BeginLine=334, DefiningType_CaseSafe=utility, LastChild=false, DefiningType=Utility, EndLine=334, Name_CaseSafe=crypto, childIdx=0, BeginColumn=26, ReferenceType=METHOD, Name=Crypto}}}, chainedNames=[Crypto], properties={FirstChild=true, FullMethodName=Crypto.encryptWithManagedIV, BeginLine=334, FullMethodName_CaseSafe=crypto.encryptwithmanagediv, DefiningType_CaseSafe=utility, LastChild=false, DefiningType=Utility, EndLine=334, MethodName_CaseSafe=encryptwithmanagediv, childIdx=0, BeginColumn=33, MethodName=encryptWithManagedIV}}}, returnedFrom=null, invocableExpression=null, method=null}: com.salesforce.graph.symbols.PathScopeVisitor.updateVariable(PathScopeVisitor.java:192);com.salesforce.graph.symbols.ClassStaticScope.updateVariable(ClassStaticScope.java:76);com.salesforce.graph.symbols.PathScopeVisitor.updateVariable(PathScopeVisitor.java:190);com.salesforce.graph.symbols.PathScopeVisitor.updateVariable(PathScopeVisitor.java:190);com.salesforce.graph.symbols.PathScopeVisitor.updateVariable(PathScopeVisitor.java:190);com.salesforce.graph.symbols.PathScopeVisitor.updateVariable(PathScopeVisitor.java:190)","https://developer.salesforce.com/docs/platform/salesforce-code-analyzer/guide/apexflsviolation-rule.html","InternalExecutionError","sfge"

Steps To Reproduce

  1. Use attached class & method
  2. Run DFT command on above class.

Expected Behavior

It should have given violations or should have been completed.

Operating System

Windows 11

Salesforce CLI Version

v18.16.0

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

4.4.0

Java Version

java 17.0.9 2023-10-17 LTS

Additional Context (Screenshots, Files, etc)

sfge log.txt
UIController.txt
Utility.txt

Workaround

No workaround.

Urgency

High

@jfeingold35
Copy link
Collaborator

@JayMalde , I'm unable to reproduce this issue on my end with the provided code.
I do get an error rooted in line 17, which appears to be resolved by replacing the chained reference gatewayList[0].Gateway_Settings_Id__c in the SOQL query with:

Payment_Gateway__c pg = gatewayList[0];
Id mId = pg.Gateway_Settings_Id__c;
.....WHERE ID =: mId...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants