SEC-1411: Unexpected behaviour of getParameterValues in SavedRequestAwareWrapper #1647

Closed
spring-issuemaster opened this Issue Feb 16, 2010 · 1 comment

1 participant

@spring-issuemaster

Johannes Scharf (Migrated from SEC-1411) said:

Recently after session timeout we suddenly got duplicate values of certain parameters in our controllers.
After some time we could figure out that the issue is related to the SavedRequest which is stored by ExceptionTranslationFilter into session. The SavedRequest contains the old values from the first request after session timeout which caused the authentication failure.

The "real" issue comes from the method "getParameterValues(String name)" in "SavedRequestAwareWrapper".
This method ALWAYS combines the parameter values of the SavedRequest with these from the current request resulting in duplicate values in the end if the values of a certain parameter are different now.
Unfortunately the method "getParameterValues" has no javadoc at all describing this behaviour.
In contrast "getParameterValue" of "SavedRequestAwareWrapper" behaves totally different (as the javadoc says)!

For my opinion "getParameterValues" should be modified so it doesn't "merge" the parameters and only return the values of the "SavedRequest" when the current request does not have a certain parameter.
Is the "merge" behaviour ever useful and/or needed?

Please check if the method could be modified as suggested and however please update the javadoc accordingly.

I've created a "workaround" by using "SecurityContextHolderAwareRequestWrapper" instead. This is perfectly save as we always redirect to the "defaultTargetUrl" after login.

@spring-issuemaster

Luke Taylor said:

The merging behaviour is required for RequestDispatcher calls. If you search Jira you will find the details. Again, the request caching is more flexible in 3.0 and allows you to more easily substitute your own behaviour.

@spring-issuemaster spring-issuemaster added this to the 3.0.2 milestone Feb 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment