Skip to content

Strip Prefix breaking OAuth Flow - spring-cloud-gateway-server-mvc-4.3.0-M3 #3759

Closed
@joaquinjsb

Description

@joaquinjsb

Describe the bug
The stripPrefix filter is interfering with redirect URLs in my Spring Authorization Server OAuth flow, specifically because the state parameter, which includes an equals sign (=), is being incorrectly processed.

for example:
/{route}/oauth2/authorize?state=EKAqtHTLsbuIH2P6jZAZhuRqzUfdTU2OnrVvDPKdcZ0%3D&redirect_uri=....

here's the exception:

java.lang.IllegalArgumentException: Invalid character '=' for QUERY_PARAM in "EKAqtHTLsbuIH2P6jZAZhuRqzUfdTU2OnrVvDPKdcZ0="
	at org.springframework.web.util.HierarchicalUriComponents.verifyUriComponent(HierarchicalUriComponents.java:422) ~[spring-web-6.2.5.jar:6.2.5]
	at org.springframework.web.util.HierarchicalUriComponents.lambda$verify$4(HierarchicalUriComponents.java:390) ~[spring-web-6.2.5.jar:6.2.5]
	at org.springframework.util.UnmodifiableMultiValueMap.lambda$forEach$0(UnmodifiableMultiValueMap.java:115) ~[spring-core-6.2.5.jar:6.2.5]
	at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:986) ~[na:na]
	at org.springframework.util.MultiValueMapAdapter.forEach(MultiValueMapAdapter.java:179) ~[spring-core-6.2.5.jar:6.2.5]
	at org.springframework.util.UnmodifiableMultiValueMap.forEach(UnmodifiableMultiValueMap.java:115) ~[spring-core-6.2.5.jar:6.2.5]
	at org.springframework.web.util.HierarchicalUriComponents.verify(HierarchicalUriComponents.java:387) ~[spring-web-6.2.5.jar:6.2.5]
	at org.springframework.web.util.HierarchicalUriComponents.<init>(HierarchicalUriComponents.java:146) ~[spring-web-6.2.5.jar:6.2.5]
	at org.springframework.web.util.UriComponentsBuilder.buildInternal(UriComponentsBuilder.java:346) ~[spring-web-6.2.5.jar:6.2.5]
	at org.springframework.web.util.UriComponentsBuilder.build(UriComponentsBuilder.java:334) ~[spring-web-6.2.5.jar:6.2.5]
	at org.springframework.cloud.gateway.server.mvc.filter.BeforeFilterFunctions.lambda$stripPrefix$32(BeforeFilterFunctions.java:438) ~[spring-cloud-gateway-server-mvc-4.3.0-M3.jar:4.3.0-M3

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions