From c43f6890297fb52b0157419238d7c2a402df0f75 Mon Sep 17 00:00:00 2001 From: Alberto Codutti Date: Fri, 28 Oct 2022 18:00:55 +0200 Subject: [PATCH] Replaced org.apache.sanselan:sanselan with org.apache.commons:commons-imaging - CVE-2018-17201 CVE-2018-17202 Signed-off-by: Alberto Codutti --- console/module/account/pom.xml | 4 ++-- .../account/server/GwtAccountServiceImpl.java | 21 ++++++++++--------- console/module/device/pom.xml | 4 ++-- .../GwtDeviceManagementServiceImpl.java | 21 ++++++++++--------- console/pom.xml | 9 -------- pom.xml | 7 +++++++ 6 files changed, 33 insertions(+), 33 deletions(-) diff --git a/console/module/account/pom.xml b/console/module/account/pom.xml index 827d79408f4..fed8149f882 100644 --- a/console/module/account/pom.xml +++ b/console/module/account/pom.xml @@ -70,8 +70,8 @@ - org.apache.sanselan - sanselan + org.apache.commons + commons-imaging commons-codec diff --git a/console/module/account/src/main/java/org/eclipse/kapua/app/console/module/account/server/GwtAccountServiceImpl.java b/console/module/account/src/main/java/org/eclipse/kapua/app/console/module/account/server/GwtAccountServiceImpl.java index ff822fb1e20..ede471f628d 100644 --- a/console/module/account/src/main/java/org/eclipse/kapua/app/console/module/account/server/GwtAccountServiceImpl.java +++ b/console/module/account/src/main/java/org/eclipse/kapua/app/console/module/account/server/GwtAccountServiceImpl.java @@ -19,8 +19,9 @@ import com.extjs.gxt.ui.client.data.PagingLoadResult; import com.google.common.collect.Sets; import org.apache.commons.codec.binary.Base64; -import org.apache.sanselan.ImageFormat; -import org.apache.sanselan.Sanselan; +import org.apache.commons.imaging.ImageFormat; +import org.apache.commons.imaging.ImageFormats; +import org.apache.commons.imaging.Imaging; import org.eclipse.kapua.app.console.module.account.shared.model.GwtAccount; import org.eclipse.kapua.app.console.module.account.shared.model.GwtAccountCreator; import org.eclipse.kapua.app.console.module.account.shared.model.GwtAccountQuery; @@ -633,14 +634,14 @@ private void checkIconResource(KapuaTicon icon) { LOG.info("Downloaded file: {}", tmpFile); // Image metadata content checks - ImageFormat imgFormat = Sanselan.guessFormat(tmpFile); - - if (imgFormat.equals(ImageFormat.IMAGE_FORMAT_BMP) || - imgFormat.equals(ImageFormat.IMAGE_FORMAT_GIF) || - imgFormat.equals(ImageFormat.IMAGE_FORMAT_JPEG) || - imgFormat.equals(ImageFormat.IMAGE_FORMAT_PNG)) { - LOG.info("Detected image format: {}", imgFormat.name); - } else if (imgFormat.equals(ImageFormat.IMAGE_FORMAT_UNKNOWN)) { + ImageFormat imgFormat = Imaging.guessFormat(tmpFile); + + if (imgFormat.equals(ImageFormats.BMP) || + imgFormat.equals(ImageFormats.GIF) || + imgFormat.equals(ImageFormats.JPEG) || + imgFormat.equals(ImageFormats.PNG)) { + LOG.info("Detected image format: {}", imgFormat.getName()); + } else if (imgFormat.equals(ImageFormats.UNKNOWN)) { LOG.error("Unknown file format for URL: {}", iconResource); throw new IOException("Unknown file format for URL: " + iconResource); } else { diff --git a/console/module/device/pom.xml b/console/module/device/pom.xml index 2bb46f6d644..26233fc8b74 100644 --- a/console/module/device/pom.xml +++ b/console/module/device/pom.xml @@ -68,8 +68,8 @@ opencsv - org.apache.sanselan - sanselan + org.apache.commons + commons-imaging commons-codec diff --git a/console/module/device/src/main/java/org/eclipse/kapua/app/console/module/device/server/GwtDeviceManagementServiceImpl.java b/console/module/device/src/main/java/org/eclipse/kapua/app/console/module/device/server/GwtDeviceManagementServiceImpl.java index 49201580ad8..9750f8e64a1 100644 --- a/console/module/device/src/main/java/org/eclipse/kapua/app/console/module/device/server/GwtDeviceManagementServiceImpl.java +++ b/console/module/device/src/main/java/org/eclipse/kapua/app/console/module/device/server/GwtDeviceManagementServiceImpl.java @@ -15,8 +15,9 @@ import com.extjs.gxt.ui.client.data.BaseListLoadResult; import com.extjs.gxt.ui.client.data.ListLoadResult; import org.apache.commons.codec.binary.Base64; -import org.apache.sanselan.ImageFormat; -import org.apache.sanselan.Sanselan; +import org.apache.commons.imaging.ImageFormat; +import org.apache.commons.imaging.ImageFormats; +import org.apache.commons.imaging.Imaging; import org.eclipse.kapua.app.console.module.api.client.GwtKapuaErrorCode; import org.eclipse.kapua.app.console.module.api.client.GwtKapuaException; import org.eclipse.kapua.app.console.module.api.server.KapuaRemoteServiceServlet; @@ -874,14 +875,14 @@ private void checkIconResource(KapuaTicon icon) { LOG.info("Downloaded file: {}", tmpFile); // Image metadata content checks - ImageFormat imgFormat = Sanselan.guessFormat(tmpFile); - - if (imgFormat.equals(ImageFormat.IMAGE_FORMAT_BMP) || - imgFormat.equals(ImageFormat.IMAGE_FORMAT_GIF) || - imgFormat.equals(ImageFormat.IMAGE_FORMAT_JPEG) || - imgFormat.equals(ImageFormat.IMAGE_FORMAT_PNG)) { - LOG.info("Detected image format: {}", imgFormat.name); - } else if (imgFormat.equals(ImageFormat.IMAGE_FORMAT_UNKNOWN)) { + ImageFormat imgFormat = Imaging.guessFormat(tmpFile); + + if (imgFormat.equals(ImageFormats.BMP) || + imgFormat.equals(ImageFormats.GIF) || + imgFormat.equals(ImageFormats.JPEG) || + imgFormat.equals(ImageFormats.PNG)) { + LOG.info("Detected image format: {}", imgFormat.getName()); + } else if (imgFormat.equals(ImageFormats.UNKNOWN)) { LOG.error("Unknown file format for URL: {}", iconResource); throw new IOException("Unknown file format for URL: " + iconResource); } else { diff --git a/console/pom.xml b/console/pom.xml index bec1db9847e..d821db4c091 100644 --- a/console/pom.xml +++ b/console/pom.xml @@ -35,7 +35,6 @@ 2.4.0 2.2.5 3.1.8 - 0.97-incubator @@ -247,14 +246,6 @@ commons-fileupload ${commons-fileupload.versison} - - - - org.apache.sanselan - sanselan - ${sanselan.version} - - diff --git a/pom.xml b/pom.xml index 06a659b50f7..d2277f741a3 100644 --- a/pom.xml +++ b/pom.xml @@ -40,6 +40,7 @@ 1.9 3.2.2 1.4 + 1.0-alpha3 2.11.0 3.4 1.2 @@ -1187,6 +1188,11 @@ commons-collections ${commons-collections.version} + + org.apache.commons + commons-imaging + ${commons-imaging.version} + commons-io commons-io @@ -1208,6 +1214,7 @@ ${commons-pool.version} + org.apache.httpcomponents httpclient