forked from github/codeql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGuice.qll
More file actions
42 lines (35 loc) · 1.23 KB
/
Copy pathGuice.qll
File metadata and controls
42 lines (35 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/**
* Provides classes and predicates for working with the Guice framework.
*/
import java
import semmle.code.java.dataflow.FlowSteps
/**
* A `@com.google.inject.servlet.RequestParameters` annotation.
*/
class GuiceRequestParametersAnnotation extends Annotation {
GuiceRequestParametersAnnotation() {
this.getType().hasQualifiedName("com.google.inject.servlet", "RequestParameters")
}
}
/**
* The interface `com.google.inject.Provider`.
*/
class GuiceProvider extends Interface {
GuiceProvider() { this.hasQualifiedName("com.google.inject", "Provider") }
/**
* The method named `get` declared on the interface `com.google.inject.Provider`.
*/
Method getGetMethod() {
result.getDeclaringType() = this and result.getName() = "get" and result.hasNoParameters()
}
/**
* A method that overrides the `get` method on the interface `com.google.inject.Provider`.
*/
Method getAnOverridingGetMethod() {
exists(Method m | m.getSourceDeclaration() = this.getGetMethod() | result.overrides*(m))
}
}
private class OverridingGetMethod extends TaintPreservingCallable {
OverridingGetMethod() { this = any(GuiceProvider gp).getAnOverridingGetMethod() }
override predicate returnsTaintFrom(int arg) { arg = -1 }
}