Skip to content

Commit 58d774a

Browse files
committed
add change notes
1 parent 60fc607 commit 58d774a

File tree

5 files changed

+13
-32
lines changed

5 files changed

+13
-32
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
lgtm,codescanning
2+
* The "Deserialization of user-controlled data" (`java/unsafe-deserialization`) query
3+
now recognizes `JYaml`, `JsonIO`, `YAMLBeans`, `HessianBurlap`, `Castor`, `Burlap` deserialization.

java/ql/src/Security/CWE/CWE-502/UnsafeDeserialization.qhelp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ may have unforeseen effects, such as the execution of arbitrary code.
1414
</p>
1515
<p>
1616
There are many different serialization frameworks. This query currently
17-
supports Kryo, XmlDecoder, XStream, SnakeYaml, Hessian, JsonIO, YAMLBeans, Castor, Burlap,
17+
supports Kryo, XmlDecoder, XStream, SnakeYaml, JYaml, JsonIO, YAMLBeans, HessianBurlap, Castor, Burlap
1818
and Java IO serialization through <code>ObjectInputStream</code>/<code>ObjectOutputStream</code>.
1919
</p>
2020
</overview>

java/ql/src/semmle/code/java/frameworks/HessianBurlap.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import java
66

77
/**
8-
* The class `com.caucho.hessian.io.AbstractHessianInput` or `com.alibaba.com.caucho.hessian.io.Hessian2StreamingInput`.
8+
* The classes `[com.alibaba.]com.caucho.hessian.io.AbstractHessianInput` or `[com.alibaba.]com.caucho.hessian.io.Hessian2StreamingInput`.
99
*/
1010
class UnsafeHessianInput extends RefType {
1111
UnsafeHessianInput() {

java/ql/src/semmle/code/java/frameworks/JYaml.qll

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,37 +5,18 @@
55
import java
66

77
/**
8-
* The class `org.ho.yaml.Yaml`.
8+
* The class `org.ho.yaml.Yaml` or `org.ho.yaml.YamlConfig`.
99
*/
10-
class JYaml extends RefType {
11-
JYaml() { this.hasQualifiedName("org.ho.yaml", "Yaml") }
10+
class JYamlLoader extends RefType {
11+
JYamlLoader() { this.hasQualifiedName("org.ho.yaml", ["Yaml", "YamlConfig"]) }
1212
}
1313

1414
/**
15-
* A JYaml unsafe load method. This is either `YAML.load` or
16-
* `YAML.loadType` or `YAML.loadStream` or `YAML.loadStreamOfType`.
15+
* A JYaml unsafe load method, declared on either `Yaml` or `YamlConfig`.
1716
*/
18-
class JYamlUnsafeLoadMethod extends Method {
19-
JYamlUnsafeLoadMethod() {
20-
this.getDeclaringType() instanceof JYaml and
21-
this.getName() in ["load", "loadType", "loadStream", "loadStreamOfType"]
22-
}
23-
}
24-
25-
/**
26-
* The class `org.ho.yaml.YamlConfig`.
27-
*/
28-
class JYamlConfig extends RefType {
29-
JYamlConfig() { this.hasQualifiedName("org.ho.yaml", "YamlConfig") }
30-
}
31-
32-
/**
33-
* A JYamlConfig unsafe load method. This is either `YamlConfig.load` or
34-
* `YAML.loadType` or `YamlConfig.loadStream` or `YamlConfig.loadStreamOfType`.
35-
*/
36-
class JYamlConfigUnsafeLoadMethod extends Method {
37-
JYamlConfigUnsafeLoadMethod() {
38-
this.getDeclaringType() instanceof JYamlConfig and
17+
class JYamlLoaderUnsafeLoadMethod extends Method {
18+
JYamlLoaderUnsafeLoadMethod() {
19+
this.getDeclaringType() instanceof JYamlLoader and
3920
this.getName() in ["load", "loadType", "loadStream", "loadStreamOfType"]
4021
}
4122
}

java/ql/src/semmle/code/java/security/UnsafeDeserialization.qll

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,7 @@ predicate unsafeDeserialization(MethodAccess ma, Expr sink) {
8787
not fastJsonLooksSafe() and
8888
sink = ma.getArgument(0)
8989
or
90-
ma.getMethod() instanceof JYamlUnsafeLoadMethod and
91-
sink = ma.getArgument(0)
92-
or
93-
ma.getMethod() instanceof JYamlConfigUnsafeLoadMethod and
90+
ma.getMethod() instanceof JYamlLoaderUnsafeLoadMethod and
9491
sink = ma.getArgument(0)
9592
or
9693
ma.getMethod() instanceof JsonIoJsonToJavaMethod and

0 commit comments

Comments
 (0)