Repository navigation
Expand file tree
/
Copy pathApacheHttp.qll
More file actions
68 lines (60 loc) · 2.05 KB
/
Copy pathApacheHttp.qll
File metadata and controls
68 lines (60 loc) · 2.05 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/**
* Provides classes and predicates related to `org.apache.http.*` and `org.apache.hc.*`.
*/
overlay[local?]
module;
import java
private import semmle.code.java.dataflow.FlowSteps
class ApacheHttpGetParams extends Method {
ApacheHttpGetParams() { this.hasQualifiedName("org.apache.http", "HttpMessage", "getParams") }
}
class ApacheHttpEntityGetContent extends Method {
ApacheHttpEntityGetContent() {
this.hasQualifiedName("org.apache.http", "HttpEntity", "getContent")
}
}
/**
* An HTTP request as represented by the Apache HTTP Client library. This is
* either `org.apache.http.client.methods.HttpRequestBase`,
* `org.apache.http.message.BasicHttpRequest`, or one of their subclasses.
*/
class ApacheHttpRequest extends RefType {
ApacheHttpRequest() {
this.getASourceSupertype*()
.hasQualifiedName("org.apache.http.client.methods", "HttpRequestBase") or
this.getASourceSupertype*().hasQualifiedName("org.apache.http.message", "BasicHttpRequest")
}
}
/**
* The `org.apache.http.client.methods.RequestBuilder` class.
*/
class TypeApacheHttpRequestBuilder extends Class {
TypeApacheHttpRequestBuilder() {
this.hasQualifiedName("org.apache.http.client.methods", "RequestBuilder")
}
}
/**
* A call that sets a header of an `HttpResponse`.
*/
class ApacheHttpSetHeader extends Call {
ApacheHttpSetHeader() {
exists(Method m |
this.getCallee().(Method).overrides*(m) and
m.getDeclaringType()
.hasQualifiedName(["org.apache.http", "org.apache.hc.core5.http"], "HttpMessage") and
m.hasName(["addHeader", "setHeader"]) and
m.getNumberOfParameters() = 2
)
or
exists(Constructor c |
this.getCallee() = c and
c.getDeclaringType()
.hasQualifiedName(["org.apache.http.message", "org.apache.hc.core5.http.message"],
"BasicHeader")
)
}
/** Gets the expression used as the name of this header. */
Expr getName() { result = this.getArgument(0) }
/** Gets the expression used as the value of this header. */
Expr getValue() { result = this.getArgument(1) }
}