kusalk commented on code in PR #919:
URL: https://github.com/apache/struts/pull/919#discussion_r1573262299
##########
core/src/main/java/org/apache/struts2/util/StrutsTestCaseHelper.java:
##########
@@ -22,23 +22,26 @@
import com.opensymphony.xwork2.inject.Container;
import com.opensymphony.xwork2.util.ValueStack;
import com.opensymphony.xwork2.util.ValueStackFactory;
-import org.apache.struts2.dispatcher.Dispatcher;
-import org.apache.struts2.dispatcher.DispatcherErrorHandler;
-
import jakarta.servlet.ServletContext;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
+import org.apache.struts2.dispatcher.Dispatcher;
+import org.apache.struts2.dispatcher.DispatcherErrorHandler;
+
+import java.util.HashMap;
import java.util.Map;
-import static java.util.Collections.emptyMap;
+import static org.apache.struts2.StrutsConstants.STRUTS_ALLOWLIST_ENABLE;
/**
* Generic test setup methods to be used with any unit testing framework.
*/
public class StrutsTestCaseHelper {
public static Dispatcher initDispatcher(ServletContext ctx, Map<String,
String> params) {
- Dispatcher du = new DispatcherWrapper(ctx, params != null ? params :
emptyMap());
+ var finalParams = new HashMap<>(params);
+ finalParams.putIfAbsent(STRUTS_ALLOWLIST_ENABLE, "false");
Review Comment:
I think it makes sense to keep the allowlist disabled for unit tests as the
auto-allowlisting is only effective in production applications
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]