Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to official Jackson fix for preventing a DoS attack #2591

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion dropwizard-bom/pom.xml
Expand Up @@ -21,7 +21,7 @@
<dropwizard.version>${project.version}</dropwizard.version>
<guava.version>24.1.1-jre</guava.version>
<jersey.version>2.25.1</jersey.version>
<jackson.version>2.9.6</jackson.version>
<jackson.version>2.9.8</jackson.version>
<jetty.version>9.4.11.v20180605</jetty.version>
<servlet.version>3.0.0.v201112011016</servlet.version>
<metrics4.version>4.0.2</metrics4.version>
Expand Down
Expand Up @@ -30,12 +30,6 @@ public void printsDetailedInformationOnMalformedContent() throws Exception {
.hasMessageContaining(String.format(
"%s has an error:%n" +
" * Malformed YAML at line: 3, column: 22; while parsing a flow sequence\n" +
" in 'reader', line 2, column 7:\n" +
" type: [ coder,wizard\n" +
" ^\n" +
"expected ',' or ']', but got StreamEnd\n" +
" in 'reader', line 2, column 21:\n" +
" wizard\n" +
" ^", malformedAdvancedFile.getName()));
" in 'reader'", malformedAdvancedFile.getName()));
}
}
Expand Up @@ -64,7 +64,6 @@ private static ObjectMapper configure(ObjectMapper mapper) {
mapper.setPropertyNamingStrategy(new AnnotationSensitivePropertyNamingStrategy());
mapper.setSubtypeResolver(new DiscoverableSubtypeResolver());

mapper.registerModule(new SafeJavaTimeModule());
return mapper;
}
}

This file was deleted.

This file was deleted.

This file was deleted.

Expand Up @@ -16,10 +16,9 @@ public class JacksonDeserializationOfBigNumbersToDurationTest {
private final ObjectMapper objectMapper = Jackson.newObjectMapper();

@Test(timeout = 5000)
public void testDoesNotAttemptToDeserializeExtremelyBigNumbers() {
assertThatExceptionOfType(JsonMappingException.class).isThrownBy(
() -> objectMapper.readValue("{\"id\": 42, \"duration\": 1e1000000000}", Task.class))
.withMessageStartingWith("Value is out of range of Duration");
public void testDoesNotAttemptToDeserializeExtremelyBigNumbers() throws Exception {
Task task = objectMapper.readValue("{\"id\": 42, \"duration\": 1e1000000000}", Task.class);
assertThat(task.getDuration()).isEqualTo(Duration.ofSeconds(0));
}

@Test
Expand Down
Expand Up @@ -16,10 +16,9 @@ public class JacksonDeserializationOfBigNumbersToInstantTest {
private final ObjectMapper objectMapper = Jackson.newObjectMapper();

@Test(timeout = 5000)
public void testDoesNotAttemptToDeserializeExtremelBigNumbers() {
assertThatExceptionOfType(JsonMappingException.class).isThrownBy(
() -> objectMapper.readValue("{\"id\": 42, \"createdAt\": 1e1000000000}", Event.class))
.withMessageStartingWith("Value is out of range of Instant");
public void testDoesNotAttemptToDeserializeExtremelBigNumbers() throws Exception {
Event event = objectMapper.readValue("{\"id\": 42, \"createdAt\": 1e1000000000}", Event.class);
assertThat(event.getCreatedAt()).isEqualTo(Instant.ofEpochMilli(0));
}

@Test
Expand Down