forked from github/codeql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathKryo.qll
More file actions
98 lines (89 loc) · 2.33 KB
/
Copy pathKryo.qll
File metadata and controls
98 lines (89 loc) · 2.33 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/**
* Provides classes and predicates for working with the Kryo serialization framework.
*/
import java
private import semmle.code.java.dataflow.DataFlow
private import semmle.code.java.dataflow.FlowSteps
/**
* The type `com.esotericsoftware.kryo.Kryo`.
*/
class Kryo extends RefType {
Kryo() {
this.hasQualifiedName("com.esotericsoftware.kryo", "Kryo") or
this.hasQualifiedName("com.esotericsoftware.kryo5", "Kryo")
}
}
/**
* A Kryo input stream.
*/
class KryoInput extends RefType {
KryoInput() {
this.hasQualifiedName("com.esotericsoftware.kryo.io", "Input") or
this.hasQualifiedName("com.esotericsoftware.kryo5.io", "Input")
}
}
/**
* A Kryo pool.
*/
class KryoPool extends RefType {
KryoPool() {
this.hasQualifiedName("com.esotericsoftware.kryo.pool", "KryoPool") or
this.hasQualifiedName("com.esotericsoftware.kryo5.pool", "KryoPool")
}
}
/**
* A Kryo pool builder.
*/
class KryoPoolBuilder extends RefType {
KryoPoolBuilder() {
this.hasQualifiedName("com.esotericsoftware.kryo.pool", "KryoPool$Builder") or
this.hasQualifiedName("com.esotericsoftware.kryo5.pool", "KryoPool$Builder")
}
}
/**
* A Kryo pool builder method used in a fluent API call chain.
*/
class KryoPoolBuilderMethod extends Method {
KryoPoolBuilderMethod() {
this.getDeclaringType() instanceof KryoPoolBuilder and
(
this.getReturnType() instanceof KryoPoolBuilder or
this.getReturnType() instanceof KryoPool
)
}
}
/**
* A Kryo method that deserializes an object.
*/
class KryoReadObjectMethod extends Method {
KryoReadObjectMethod() {
this.getDeclaringType() instanceof Kryo and
(
this.hasName("readClassAndObject") or
this.hasName("readObject") or
this.hasName("readObjectOrNull")
)
}
}
/**
* A call to `Kryo.setRegistrationRequired` that enables white-listing.
*/
class KryoEnableWhiteListing extends MethodAccess {
KryoEnableWhiteListing() {
exists(Method m |
m = this.getMethod() and
m.getDeclaringType() instanceof Kryo and
m.hasName("setRegistrationRequired") and
this.getAnArgument().(BooleanLiteral).getBooleanValue() = true
)
}
}
/**
* A KryoPool method that uses a Kryo instance.
*/
class KryoPoolRunMethod extends Method {
KryoPoolRunMethod() {
this.getDeclaringType() instanceof KryoPool and
this.hasName("run")
}
}