@@ -7,26 +7,11 @@ class JShellInjectionSink extends DataFlow::Node {
7
7
this .asExpr ( ) = any ( JShellEvalCall jsec ) .getArgument ( 0 )
8
8
or
9
9
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
- )
25
10
}
26
11
}
27
12
28
13
/** A call to `JShell.eval`. */
29
- class JShellEvalCall extends MethodAccess {
14
+ private class JShellEvalCall extends MethodAccess {
30
15
JShellEvalCall ( ) {
31
16
this .getMethod ( ) .hasName ( "eval" ) and
32
17
this .getMethod ( ) .getDeclaringType ( ) .hasQualifiedName ( "jdk.jshell" , "JShell" ) and
@@ -35,10 +20,34 @@ class JShellEvalCall extends MethodAccess {
35
20
}
36
21
37
22
/** A call to `SourceCodeAnalysis.wrappers`. */
38
- class SourceCodeAnalysisWrappersCall extends MethodAccess {
23
+ private class SourceCodeAnalysisWrappersCall extends MethodAccess {
39
24
SourceCodeAnalysisWrappersCall ( ) {
40
25
this .getMethod ( ) .hasName ( "wrappers" ) and
41
26
this .getMethod ( ) .getDeclaringType ( ) .hasQualifiedName ( "jdk.jshell" , "SourceCodeAnalysis" ) and
42
27
this .getMethod ( ) .getNumberOfParameters ( ) = 1
43
28
}
44
29
}
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