From 5eddec8c461bfabd96c36a5df09e5e48947a98c7 Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Fri, 7 Oct 2022 15:44:01 +0100 Subject: [PATCH] HADOOP-18468: Upgrade jettison to 1.5.1 to fix CVE-2022-40149 (#4937) Contributed by PJ Fanning --- LICENSE-binary | 2 +- hadoop-project/pom.xml | 2 +- .../webapp/TestRMWebServicesCapacitySched.java | 13 ++++++++++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/LICENSE-binary b/LICENSE-binary index 0f6e7248dd..ddaf5755bd 100644 --- a/LICENSE-binary +++ b/LICENSE-binary @@ -343,7 +343,7 @@ org.apache.kerby:token-provider:2.0.2 org.apache.solr:solr-solrj:8.8.2 org.apache.yetus:audience-annotations:0.5.0 org.apache.zookeeper:zookeeper:3.6.3 -org.codehaus.jettison:jettison:1.1 +org.codehaus.jettison:jettison:1.5.1 org.eclipse.jetty:jetty-annotations:9.4.48.v20220622 org.eclipse.jetty:jetty-http:9.4.48.v20220622 org.eclipse.jetty:jetty-io:9.4.48.v20220622 diff --git a/hadoop-project/pom.xml b/hadoop-project/pom.xml index 30808f2c70..716fcfaa74 100644 --- a/hadoop-project/pom.xml +++ b/hadoop-project/pom.xml @@ -1499,7 +1499,7 @@ org.codehaus.jettison jettison - 1.1 + 1.5.1 stax diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebServicesCapacitySched.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebServicesCapacitySched.java index b9ce10aaed..258947af4e 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebServicesCapacitySched.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebServicesCapacitySched.java @@ -18,6 +18,8 @@ package org.apache.hadoop.yarn.server.resourcemanager.webapp; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; import com.google.inject.Guice; import com.google.inject.servlet.ServletModule; import com.sun.jersey.api.client.ClientResponse; @@ -334,7 +336,16 @@ public static void assertJsonResponse(ClientResponse response, JSONObject json = response.getEntity(JSONObject.class); String actual = json.toString(2); updateTestDataAutomatically(expectedResourceFilename, actual); - assertEquals(getResourceAsString(expectedResourceFilename), actual); + assertEquals( + prettyPrintJson(getResourceAsString(expectedResourceFilename)), + prettyPrintJson(actual)); + } + + private static String prettyPrintJson(String in) throws JsonProcessingException { + ObjectMapper objectMapper = new ObjectMapper(); + return objectMapper + .writerWithDefaultPrettyPrinter() + .writeValueAsString(objectMapper.readTree(in)); } public static void assertJsonType(ClientResponse response) {