From 1d07b75ca9adc03f5df21f6f6d8fd090f3f440bf Mon Sep 17 00:00:00 2001 From: Arne Franken Date: Sun, 28 Apr 2024 15:13:26 +0200 Subject: [PATCH] Bump spring-boot.version from 3.2.4 to 3.2.5 This updates Jetty to 12.0.8 where they changed the UriCompliance yet again. We need to use "UNSAFE" now. https://github.com/jetty/jetty.project/issues/11495 --- .../adobe/testing/s3mock/its/ListObjectV1IT.kt | 5 ++--- .../adobe/testing/s3mock/its/ListObjectV2IT.kt | 2 +- .../com/adobe/testing/s3mock/its/S3TestBase.kt | 17 +++++++++++++++++ pom.xml | 2 +- .../testing/s3mock/S3MockConfiguration.java | 2 +- 5 files changed, 22 insertions(+), 6 deletions(-) diff --git a/integration-tests/src/test/kotlin/com/adobe/testing/s3mock/its/ListObjectV1IT.kt b/integration-tests/src/test/kotlin/com/adobe/testing/s3mock/its/ListObjectV1IT.kt index 772b3cb84..6ae36e73c 100644 --- a/integration-tests/src/test/kotlin/com/adobe/testing/s3mock/its/ListObjectV1IT.kt +++ b/integration-tests/src/test/kotlin/com/adobe/testing/s3mock/its/ListObjectV1IT.kt @@ -171,7 +171,7 @@ internal class ListObjectV1IT : S3TestBase() { fun shouldListWithCorrectObjectNames(testInfo: TestInfo) { val bucketName = givenBucketV1(testInfo) val uploadFile = File(UPLOAD_FILE_NAME) - val weirdStuff = ("$&_ .,':\u0001") // use only characters that are safe or need special handling + val weirdStuff = charsSafe() val prefix = "shouldListWithCorrectObjectNames/" val key = "$prefix$weirdStuff${uploadFile.name}$weirdStuff" s3Client.putObject(PutObjectRequest(bucketName, key, uploadFile)) @@ -192,10 +192,9 @@ internal class ListObjectV1IT : S3TestBase() { fun shouldListV2WithCorrectObjectNames(testInfo: TestInfo) { val bucketName = givenBucketV1(testInfo) val uploadFile = File(UPLOAD_FILE_NAME) - val weirdStuff = ("$&_ .,':\u0001") // use only characters that are safe or need special handling + val weirdStuff = charsSafe() val prefix = "shouldListWithCorrectObjectNames/" val key = "$prefix$weirdStuff${uploadFile.name}$weirdStuff" - s3Client.putObject(PutObjectRequest(bucketName, key, uploadFile)) // AWS client ListObjects V2 defaults to no encoding whereas V1 defaults to URL diff --git a/integration-tests/src/test/kotlin/com/adobe/testing/s3mock/its/ListObjectV2IT.kt b/integration-tests/src/test/kotlin/com/adobe/testing/s3mock/its/ListObjectV2IT.kt index b67bc42f8..a5b18a007 100644 --- a/integration-tests/src/test/kotlin/com/adobe/testing/s3mock/its/ListObjectV2IT.kt +++ b/integration-tests/src/test/kotlin/com/adobe/testing/s3mock/its/ListObjectV2IT.kt @@ -117,7 +117,7 @@ internal class ListObjectV2IT : S3TestBase() { fun shouldListV2WithCorrectObjectNames(testInfo: TestInfo) { val bucketName = givenBucketV2(testInfo) val uploadFile = File(UPLOAD_FILE_NAME) - val weirdStuff = ("!-_.*'()") //safe characters as per S3 API + val weirdStuff = charsSafe() val prefix = "shouldListWithCorrectObjectNames/" val key = "$prefix$weirdStuff${uploadFile.name}$weirdStuff" s3ClientV2.putObject(PutObjectRequest diff --git a/integration-tests/src/test/kotlin/com/adobe/testing/s3mock/its/S3TestBase.kt b/integration-tests/src/test/kotlin/com/adobe/testing/s3mock/its/S3TestBase.kt index 69ce23fe0..aafc2ebcf 100644 --- a/integration-tests/src/test/kotlin/com/adobe/testing/s3mock/its/S3TestBase.kt +++ b/integration-tests/src/test/kotlin/com/adobe/testing/s3mock/its/S3TestBase.kt @@ -646,6 +646,12 @@ internal abstract class S3TestBase { "$PREFIX${chars_safe_special()}" ) } + + @JvmStatic + protected fun charsSafeKey(): String { + return "$PREFIX${chars_safe_alphanumeric()}${chars_safe_special()}" + } + @JvmStatic protected fun charsSpecial(): Stream { return Stream.of( @@ -653,6 +659,12 @@ internal abstract class S3TestBase { //"$PREFIX${chars_specialHandling_unicode()}" //TODO: some of these chars to not work. ) } + + @JvmStatic + protected fun charsSpecialKey(): String { + return "$PREFIX${chars_specialHandling()}" + } + @JvmStatic protected fun charsToAvoid(): Stream { return Stream.of( @@ -661,6 +673,11 @@ internal abstract class S3TestBase { ) } + @JvmStatic + protected fun charsToAvoidKey(): String { + return "$PREFIX${chars_toAvoid()}" + } + /** * Chars that are safe to use * https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html diff --git a/pom.xml b/pom.xml index 9b5c0f0c9..4c2dc4e5a 100644 --- a/pom.xml +++ b/pom.xml @@ -126,7 +126,7 @@ false 3.4.1 - 3.2.4 + 3.2.5 1.19.7 7.10.1 2.9.1 diff --git a/server/src/main/java/com/adobe/testing/s3mock/S3MockConfiguration.java b/server/src/main/java/com/adobe/testing/s3mock/S3MockConfiguration.java index 005e415e6..954312ae9 100644 --- a/server/src/main/java/com/adobe/testing/s3mock/S3MockConfiguration.java +++ b/server/src/main/java/com/adobe/testing/s3mock/S3MockConfiguration.java @@ -86,7 +86,7 @@ ServletWebServerFactory webServerFactory(S3MockProperties properties) { .map(hc -> { //disable UriCompliance checks. S3 allows object keys that do not conform to //URI specs as defined here: https://datatracker.ietf.org/doc/html/rfc3986 - hc.setUriCompliance(UriCompliance.LEGACY); + hc.setUriCompliance(UriCompliance.UNSAFE); return hc.getCustomizer(SecureRequestCustomizer.class); }) .filter(Objects::nonNull)