Skip to content

Commit 5a68ac8

Browse files
committed
Cleanup Jackson logic after code review
1 parent bacc3ef commit 5a68ac8

File tree

5 files changed

+11
-16
lines changed

5 files changed

+11
-16
lines changed

java/ql/src/semmle/code/java/frameworks/jackson/JacksonSerializability.qll

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -72,18 +72,6 @@ private class ExplicitlyWrittenJacksonSerializableType extends JacksonSerializab
7272
}
7373
}
7474

75-
/** A type whose values are explicitly deserialized in a call to a Jackson method. */
76-
private class ExplicitlyReadJacksonSerializableType extends JacksonDeserializableType {
77-
ExplicitlyReadJacksonSerializableType() {
78-
exists(MethodAccess ma |
79-
// A call to a Jackson read method...
80-
ma.getMethod() instanceof JacksonReadValueMethod and
81-
// ...where `this` is used in the final argument, indicating that this type will be deserialized.
82-
usesType(ma.getArgument(ma.getNumArgument() - 1).getType(), this)
83-
)
84-
}
85-
}
86-
8775
/** A type used in a `JacksonSerializableField` declaration. */
8876
private class FieldReferencedJacksonSerializableType extends JacksonSerializableType {
8977
FieldReferencedJacksonSerializableType() {
@@ -123,6 +111,13 @@ private class ExplicitlyReadJacksonDeserializableType extends JacksonDeserializa
123111
exists(TypeLiteralToJacksonDatabindFlowConfiguration conf |
124112
usesType(conf.getSourceWithFlowToJacksonDatabind().getTypeName().getType(), this)
125113
)
114+
or
115+
exists(MethodAccess ma |
116+
// A call to a Jackson read method...
117+
ma.getMethod() instanceof JacksonReadValueMethod and
118+
// ...where `this` is used in the final argument, indicating that this type will be deserialized.
119+
usesType(ma.getArgument(ma.getNumArgument() - 1).getType(), this)
120+
)
126121
}
127122
}
128123

java/ql/test/library-tests/dataflow/taint-jackson/dataFlow.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ class HasFlowTest extends InlineExpectationsTest {
3131
value = ""
3232
)
3333
}
34-
}
34+
}

java/ql/test/stubs/jackson-databind-2.10/com/fasterxml/jackson/databind/JsonNode.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
public abstract class JsonNode implements Iterable<JsonNode> {
66
public JsonNode() {
77
}
8-
}
8+
}

java/ql/test/stubs/jackson-databind-2.10/com/fasterxml/jackson/databind/MappingIterator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ public void remove() {
2525
public void close() throws IOException {
2626

2727
}
28-
}
28+
}

java/ql/test/stubs/jackson-databind-2.10/com/fasterxml/jackson/databind/ObjectReader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,4 @@ public <T> MappingIterator<T> readValues(Reader src, Class<T> valueType) throws
7979
return null;
8080
}
8181

82-
}
82+
}

0 commit comments

Comments
 (0)