@@ -4,10 +4,15 @@ import semmle.code.java.dataflow.FlowSources
4
4
import DataFlow:: PathGraph
5
5
6
6
/** Json string type data. */
7
- abstract class JsonpStringSource extends DataFlow:: Node { }
7
+ abstract class JsonStringSource extends DataFlow:: Node { }
8
8
9
- /** Convert to String using Gson library. */
10
- private class GsonString extends JsonpStringSource {
9
+ /**
10
+ * Convert to String using Gson library. *
11
+ *
12
+ * For example, in the method access `Gson.toJson(...)`,
13
+ * the `Object` type data is converted to the `String` type data.
14
+ */
15
+ private class GsonString extends JsonStringSource {
11
16
GsonString ( ) {
12
17
exists ( MethodAccess ma , Method m | ma .getMethod ( ) = m |
13
18
m .hasName ( "toJson" ) and
@@ -17,8 +22,13 @@ private class GsonString extends JsonpStringSource {
17
22
}
18
23
}
19
24
20
- /** Convert to String using Fastjson library. */
21
- private class FastjsonString extends JsonpStringSource {
25
+ /**
26
+ * Convert to String using Fastjson library.
27
+ *
28
+ * For example, in the method access `JSON.toJSONString(...)`,
29
+ * the `Object` type data is converted to the `String` type data.
30
+ */
31
+ private class FastjsonString extends JsonStringSource {
22
32
FastjsonString ( ) {
23
33
exists ( MethodAccess ma , Method m | ma .getMethod ( ) = m |
24
34
m .hasName ( "toJSONString" ) and
@@ -28,8 +38,13 @@ private class FastjsonString extends JsonpStringSource {
28
38
}
29
39
}
30
40
31
- /** Convert to String using Jackson library. */
32
- private class JacksonString extends JsonpStringSource {
41
+ /**
42
+ * Convert to String using Jackson library.
43
+ *
44
+ * For example, in the method access `ObjectMapper.writeValueAsString(...)`,
45
+ * the `Object` type data is converted to the `String` type data.
46
+ */
47
+ private class JacksonString extends JsonStringSource {
33
48
JacksonString ( ) {
34
49
exists ( MethodAccess ma , Method m | ma .getMethod ( ) = m |
35
50
m .hasName ( "writeValueAsString" ) and
0 commit comments