Skip to content

Commit

Permalink
Bump spring-boot.version from 3.2.4 to 3.2.5
Browse files Browse the repository at this point in the history
This updates Jetty to 12.0.8 where they changed the UriCompliance
yet again. We need to use "UNSAFE" now.
jetty/jetty.project#11495
  • Loading branch information
afranken committed Apr 28, 2024
1 parent ddac870 commit 1d07b75
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -646,13 +646,25 @@ 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<String> {
return Stream.of(
"$PREFIX${chars_specialHandling()}",
//"$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<String> {
return Stream.of(
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
<!-- Run Docker build by default -->
<skipDocker>false</skipDocker>
<sortpom-maven-plugin.version>3.4.1</sortpom-maven-plugin.version>
<spring-boot.version>3.2.4</spring-boot.version>
<spring-boot.version>3.2.5</spring-boot.version>
<testcontainers.version>1.19.7</testcontainers.version>
<testng.version>7.10.1</testng.version>
<xmlunit-assertj3.version>2.9.1</xmlunit-assertj3.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 1d07b75

Please sign in to comment.