@@ -7,26 +7,11 @@ class JShellInjectionSink extends DataFlow::Node {
77 this .asExpr ( ) = any ( JShellEvalCall jsec ) .getArgument ( 0 )
88 or
99 this .asExpr ( ) = any ( SourceCodeAnalysisWrappersCall scawc ) .getArgument ( 0 )
10- or
11- exists ( MethodAccess ma |
12- ma .getMethod ( ) .hasName ( "source" ) and
13- ma .getMethod ( ) .getNumberOfParameters ( ) = 0 and
14- ma .getMethod ( )
15- .getDeclaringType ( )
16- .getASupertype * ( )
17- .hasQualifiedName ( "jdk.jshell" , "SourceCodeAnalysis$CompletionInfo" ) and
18- ma .getQualifier ( ) = this .asExpr ( ) and
19- (
20- ma = any ( JShellEvalCall jsec ) .getArgument ( 0 )
21- or
22- ma = any ( SourceCodeAnalysisWrappersCall scawc ) .getArgument ( 0 )
23- )
24- )
2510 }
2611}
2712
2813/** A call to `JShell.eval`. */
29- class JShellEvalCall extends MethodAccess {
14+ private class JShellEvalCall extends MethodAccess {
3015 JShellEvalCall ( ) {
3116 this .getMethod ( ) .hasName ( "eval" ) and
3217 this .getMethod ( ) .getDeclaringType ( ) .hasQualifiedName ( "jdk.jshell" , "JShell" ) and
@@ -35,10 +20,34 @@ class JShellEvalCall extends MethodAccess {
3520}
3621
3722/** A call to `SourceCodeAnalysis.wrappers`. */
38- class SourceCodeAnalysisWrappersCall extends MethodAccess {
23+ private class SourceCodeAnalysisWrappersCall extends MethodAccess {
3924 SourceCodeAnalysisWrappersCall ( ) {
4025 this .getMethod ( ) .hasName ( "wrappers" ) and
4126 this .getMethod ( ) .getDeclaringType ( ) .hasQualifiedName ( "jdk.jshell" , "SourceCodeAnalysis" ) and
4227 this .getMethod ( ) .getNumberOfParameters ( ) = 1
4328 }
4429}
30+
31+ /** A call to `SourceCodeAnalysis.analyzeCompletion`. */
32+ class SourceCodeAnalysisAnalyzeCompletionCall extends MethodAccess {
33+ SourceCodeAnalysisAnalyzeCompletionCall ( ) {
34+ this .getMethod ( ) .hasName ( "analyzeCompletion" ) and
35+ this .getMethod ( )
36+ .getDeclaringType ( )
37+ .getASupertype * ( )
38+ .hasQualifiedName ( "jdk.jshell" , "SourceCodeAnalysis" ) and
39+ this .getMethod ( ) .getNumberOfParameters ( ) = 1
40+ }
41+ }
42+
43+ /** A call to `CompletionInfo.source` or `CompletionInfo.remaining`. */
44+ class CompletionInfoSourceOrRemainingCall extends MethodAccess {
45+ CompletionInfoSourceOrRemainingCall ( ) {
46+ this .getMethod ( ) .getName ( ) in [ "source" , "remaining" ] and
47+ this .getMethod ( )
48+ .getDeclaringType ( )
49+ .getASupertype * ( )
50+ .hasQualifiedName ( "jdk.jshell" , "SourceCodeAnalysis$CompletionInfo" ) and
51+ this .getMethod ( ) .getNumberOfParameters ( ) = 0
52+ }
53+ }
0 commit comments