@@ -4,10 +4,15 @@ import semmle.code.java.dataflow.FlowSources
44import DataFlow:: PathGraph
55
66/** Json string type data. */
7- abstract class JsonpStringSource extends DataFlow:: Node { }
7+ abstract class JsonStringSource extends DataFlow:: Node { }
88
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 {
1116 GsonString ( ) {
1217 exists ( MethodAccess ma , Method m | ma .getMethod ( ) = m |
1318 m .hasName ( "toJson" ) and
@@ -17,8 +22,13 @@ private class GsonString extends JsonpStringSource {
1722 }
1823}
1924
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 {
2232 FastjsonString ( ) {
2333 exists ( MethodAccess ma , Method m | ma .getMethod ( ) = m |
2434 m .hasName ( "toJSONString" ) and
@@ -28,8 +38,13 @@ private class FastjsonString extends JsonpStringSource {
2838 }
2939}
3040
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 {
3348 JacksonString ( ) {
3449 exists ( MethodAccess ma , Method m | ma .getMethod ( ) = m |
3550 m .hasName ( "writeValueAsString" ) and
0 commit comments