From af0066f4223110ce5e536b460df5286874c0d865 Mon Sep 17 00:00:00 2001 From: Alar Floren Date: Fri, 26 Apr 2024 09:42:18 +0300 Subject: [PATCH 1/2] Don't allow duplicate keys in body JSON --- .../ruuter/configuration/JacksonConfiguration.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/ee/buerokratt/ruuter/configuration/JacksonConfiguration.java b/src/main/java/ee/buerokratt/ruuter/configuration/JacksonConfiguration.java index deae6410..7eccaa63 100644 --- a/src/main/java/ee/buerokratt/ruuter/configuration/JacksonConfiguration.java +++ b/src/main/java/ee/buerokratt/ruuter/configuration/JacksonConfiguration.java @@ -1,18 +1,23 @@ package ee.buerokratt.ruuter.configuration; +import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; +import org.apache.tomcat.util.json.JSONParser; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Primary; +import org.springframework.http.converter.HttpMessageConverter; + +import java.util.Map; @Configuration public class JacksonConfiguration { @Bean @Primary public ObjectMapper objectMapper() { - return new ObjectMapper(); + return new ObjectMapper().configure(JsonParser.Feature.STRICT_DUPLICATE_DETECTION, true); } @Bean @@ -20,3 +25,4 @@ public ObjectMapper ymlMapper() { return new ObjectMapper(new YAMLFactory()).configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); } } + From 0231d0227260fec331b9756f7921b9949a783a92 Mon Sep 17 00:00:00 2001 From: Alar Floren Date: Mon, 29 Apr 2024 16:53:03 +0300 Subject: [PATCH 2/2] Update docker base image (OpenJDK is deprecated) --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 1e47c92f..0767bbeb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM openjdk:17-jdk as build +FROM eclipse-temurin:17-jdk-alpine as build WORKDIR /workspace/app COPY gradlew .