Skip to content

Commit 6983850

Browse files
committed
Upgrade to Undertow 2.3.4.Final
Closes gh-34273
1 parent 3614232 commit 6983850

File tree

4 files changed

+41
-6
lines changed

4 files changed

+41
-6
lines changed

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2022 the original author or authors.
2+
* Copyright 2012-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -1506,10 +1506,19 @@ public static class Undertow {
15061506
* Whether the server should decode percent encoded slash characters. Enabling
15071507
* encoded slashes can have security implications due to different servers
15081508
* interpreting the slash differently. Only enable this if you have a legacy
1509-
* application that requires it.
1509+
* application that requires it. Has no effect when server.undertow.decode-slash
1510+
* is set.
15101511
*/
15111512
private boolean allowEncodedSlash = false;
15121513

1514+
/**
1515+
* Whether encoded slash characters (%2F) should be decoded. Decoding can cause
1516+
* security problems if a front-end proxy does not perform the same decoding. Only
1517+
* enable this if you have a legacy application that requires it. When set,
1518+
* server.undertow.allow-encoded-slash has no effect.
1519+
*/
1520+
private Boolean decodeSlash;
1521+
15131522
/**
15141523
* Whether the URL should be decoded. When disabled, percent-encoded characters in
15151524
* the URL will be left as-is.
@@ -1603,14 +1612,25 @@ public void setMaxCookies(Integer maxCookies) {
16031612
this.maxCookies = maxCookies;
16041613
}
16051614

1615+
@DeprecatedConfigurationProperty(replacement = "server.undertow.decode-slash")
1616+
@Deprecated(forRemoval = true, since = "3.0.3")
16061617
public boolean isAllowEncodedSlash() {
16071618
return this.allowEncodedSlash;
16081619
}
16091620

1621+
@Deprecated(forRemoval = true, since = "3.0.3")
16101622
public void setAllowEncodedSlash(boolean allowEncodedSlash) {
16111623
this.allowEncodedSlash = allowEncodedSlash;
16121624
}
16131625

1626+
public Boolean getDecodeSlash() {
1627+
return this.decodeSlash;
1628+
}
1629+
1630+
public void setDecodeSlash(Boolean decodeSlash) {
1631+
this.decodeSlash = decodeSlash;
1632+
}
1633+
16141634
public boolean isDecodeUrl() {
16151635
return this.decodeUrl;
16161636
}

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/embedded/UndertowWebServerFactoryCustomizer.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2022 the original author or authors.
2+
* Copyright 2012-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -98,7 +98,7 @@ private void mapUndertowProperties(ConfigurableUndertowWebServerFactory factory,
9898
map.from(properties::getMaxParameters).to(serverOptions.option(UndertowOptions.MAX_PARAMETERS));
9999
map.from(properties::getMaxHeaders).to(serverOptions.option(UndertowOptions.MAX_HEADERS));
100100
map.from(properties::getMaxCookies).to(serverOptions.option(UndertowOptions.MAX_COOKIES));
101-
map.from(properties::isAllowEncodedSlash).to(serverOptions.option(UndertowOptions.ALLOW_ENCODED_SLASH));
101+
mapSlashProperties(properties, serverOptions);
102102
map.from(properties::isDecodeUrl).to(serverOptions.option(UndertowOptions.DECODE_URL));
103103
map.from(properties::getUrlCharset).as(Charset::name).to(serverOptions.option(UndertowOptions.URL_CHARSET));
104104
map.from(properties::isAlwaysSetKeepAlive).to(serverOptions.option(UndertowOptions.ALWAYS_SET_KEEP_ALIVE));
@@ -109,6 +109,14 @@ private void mapUndertowProperties(ConfigurableUndertowWebServerFactory factory,
109109
map.from(properties.getOptions()::getSocket).to(socketOptions.forEach(socketOptions::option));
110110
}
111111

112+
@SuppressWarnings({ "deprecation", "removal" })
113+
private void mapSlashProperties(Undertow properties, ServerOptions serverOptions) {
114+
PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull();
115+
map.from(properties::isAllowEncodedSlash).to(serverOptions.option(UndertowOptions.ALLOW_ENCODED_SLASH));
116+
map.from(properties::getDecodeSlash).to(serverOptions.option(UndertowOptions.DECODE_SLASH));
117+
118+
}
119+
112120
private boolean isPositive(Number value) {
113121
return value.longValue() > 0;
114122
}

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/embedded/UndertowWebServerFactoryCustomizerTests.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2022 the original author or authors.
2+
* Copyright 2012-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -150,11 +150,18 @@ void customizeWorkerThreads() {
150150
}
151151

152152
@Test
153+
@Deprecated(forRemoval = true, since = "3.0.3")
153154
void allowEncodedSlashes() {
154155
bind("server.undertow.allow-encoded-slash=true");
155156
assertThat(boundServerOption(UndertowOptions.ALLOW_ENCODED_SLASH)).isTrue();
156157
}
157158

159+
@Test
160+
void enableSlashDecoding() {
161+
bind("server.undertow.decode-slash=true");
162+
assertThat(boundServerOption(UndertowOptions.DECODE_SLASH)).isTrue();
163+
}
164+
158165
@Test
159166
void disableUrlDecoding() {
160167
bind("server.undertow.decode-url=false");

spring-boot-project/spring-boot-dependencies/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1502,7 +1502,7 @@ bom {
15021502
]
15031503
}
15041504
}
1505-
library("Undertow", "2.3.3.Final") {
1505+
library("Undertow", "2.3.4.Final") {
15061506
group("io.undertow") {
15071507
modules = [
15081508
"undertow-core",

0 commit comments

Comments
 (0)