forked from github/codeql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathXStream.qll
More file actions
44 lines (40 loc) · 1.09 KB
/
Copy pathXStream.qll
File metadata and controls
44 lines (40 loc) · 1.09 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
/**
* Provides classes and predicates for working with the XStream XML serialization framework.
*/
import java
/**
* The type `com.thoughtworks.xstream.XStream`.
*/
class XStream extends RefType {
XStream() { this.hasQualifiedName("com.thoughtworks.xstream", "XStream") }
}
/**
* An XStream method that deserializes an object.
*/
class XStreamReadObjectMethod extends Method {
XStreamReadObjectMethod() {
this.getDeclaringType() instanceof XStream and
(
this.hasName("fromXML") or
this.hasName("unmarshal")
)
}
}
/**
* A call to `XStream.addPermission(NoTypePermission.NONE)`, which enables white-listing.
*/
class XStreamEnableWhiteListing extends MethodAccess {
XStreamEnableWhiteListing() {
exists(Method m |
m = this.getMethod() and
m.getDeclaringType() instanceof XStream and
m.hasName("addPermission") and
exists(Field f |
this.getAnArgument() = f.getAnAccess() and
f.hasName("NONE") and
f.getDeclaringType()
.hasQualifiedName("com.thoughtworks.xstream.security", "NoTypePermission")
)
)
}
}