-
Notifications
You must be signed in to change notification settings - Fork 38.5k
Restrict forwards in MockMvcWebConnection to 100 #29557
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
When a filter is configured to conditionally forward, and it is configured to handle FORWARD dispatches as well, and it prevents infinite forward loops by either extending OncePerRequestFilter or otherwise using request attributes, this can result in infinite forward loops in WebClient tests using MockMvcWebConnection. This change will restrict the maximum number of forwards in MockMvcWebConnection to 100. Closes spring-projectsgh-29483
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@manthanb thanks for the contribution. I think that throwing an exception as proposed in the original issue would be better, wdyt? The message can mention that there is a probable infinite loop and that it forwarded 100 times.
@manthanb are you still able to work on this? (cf review above) |
Hi @simonbasle Very sorry I missed your last comment. Yes, I will make the changes and commit today. |
(note: to be backported in 5.3.x, as tracked by gh-29866) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went ahead and made the adjustments to throw rather than ignore
This change restricts the maximum number of forwards in MockMvcWebConnection to 100, in case a forward is configured in a way that causes a loop. This is necessary in HtmlUnit backed tests, unlike in classic MockMvc tests in which the forwards are not actually resolved. See gh-29557 Closes gh-29866 Co-authored-by: Simon Baslé <sbasle@vmware.com>
When a filter is configured to conditionally forward, and it is configured to handle FORWARD dispatches as well, and it prevents infinite forward loops by either extending OncePerRequestFilter or otherwise using request attributes, this can result in infinite forward loops in WebClient tests using MockMvcWebConnection. This change will restrict the maximum number of forwards in MockMvcWebConnection to 100.
Closes gh-29483