File tree Expand file tree Collapse file tree 2 files changed +36
-0
lines changed
java/ql/src/semmle/code/java Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ import semmle.code.java.frameworks.android.Intent
1919import semmle.code.java.frameworks.SpringWeb
2020import semmle.code.java.frameworks.Guice
2121import semmle.code.java.frameworks.struts.StrutsActions
22+ import semmle.code.java.frameworks.Thrift
2223
2324/** Class for `tainted` user input. */
2425abstract class UserInput extends DataFlow:: Node { }
@@ -78,6 +79,8 @@ class RemoteUserInput extends UserInput {
7879 )
7980 or
8081 exists ( Struts2ActionSupportClass c | c .getASetterMethod ( ) .getField ( ) = this .asExpr ( ) .( FieldRead ) .getField ( ) )
82+ or
83+ exists ( ThriftIface i | i .getAnImplementingMethod ( ) .getAParameter ( ) = this .asParameter ( ) )
8184 }
8285
8386 /**
Original file line number Diff line number Diff line change 1+ /**
2+ * Provides classes and predicates for working with the Apache Thrift framework.
3+ */
4+
5+ import java
6+
7+ /**
8+ * A file detected as generated by the Apache Thrift Compiler.
9+ */
10+ class ThriftGeneratedFile extends GeneratedFile {
11+ ThriftGeneratedFile ( ) {
12+ exists ( JavadocElement t | t .getFile ( ) = this |
13+ exists ( string msg | msg = t .getText ( ) | msg .regexpMatch ( "(?i).*\\bAutogenerated by Thrift.*" ) )
14+ )
15+ }
16+ }
17+
18+ /**
19+ * A Thrift `Iface` interface in a class generated by the Apache Thrift Compiler.
20+ */
21+ class ThriftIface extends Interface {
22+ ThriftIface ( ) {
23+ this .hasName ( "Iface" ) and
24+ this .getEnclosingType ( ) instanceof TopLevelType and
25+ this .getFile ( ) instanceof ThriftGeneratedFile
26+ }
27+
28+ Method getAnImplementingMethod ( ) {
29+ result .getDeclaringType ( ) .( Class ) .getASupertype + ( ) = this and
30+ result .overrides ( getAMethod ( ) ) and
31+ not result .getFile ( ) = this .getFile ( )
32+ }
33+ }
You can’t perform that action at this time.
0 commit comments