This is an automated email from the ASF dual-hosted git repository.
lukaszlenart pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/struts.git
The following commit(s) were added to refs/heads/main by this push:
new f2ea51ac3 WW-4323 test(core): pin that ParameterNameAware cannot
accept an excluded name
f2ea51ac3 is described below
commit f2ea51ac3e3c723d670e1734c413d5fe5c31104c
Author: Lukasz Lenart <[email protected]>
AuthorDate: Thu Oct 22 12:07:38 2026 +0200
WW-4323 test(core): pin that ParameterNameAware cannot accept an excluded
name
ParameterNameAware narrows what the interceptor accepts; it never
overrides the global name checks. The existing testParameterNameAware
does not tell the two semantics apart because its action rejects every
extra key itself.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
.../interceptor/parameter/ParametersInterceptorTest.java | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git
a/core/src/test/java/org/apache/struts2/interceptor/parameter/ParametersInterceptorTest.java
b/core/src/test/java/org/apache/struts2/interceptor/parameter/ParametersInterceptorTest.java
index 232bd0451..2e1301071 100644
---
a/core/src/test/java/org/apache/struts2/interceptor/parameter/ParametersInterceptorTest.java
+++
b/core/src/test/java/org/apache/struts2/interceptor/parameter/ParametersInterceptorTest.java
@@ -100,6 +100,21 @@ public class ParametersInterceptorTest extends
XWorkTestCase {
assertEquals(expected, actual);
}
+ public void testParameterNameAwareCannotAcceptExcludedName() {
+ ParametersInterceptor pi = createParametersInterceptor();
+ pi.setExcludeParams("blockedKey");
+ final Map<String, Object> actual = injectValueStackFactory(pi);
+ ValueStack stack = createStubValueStack(actual);
+ ParameterNameAware acceptsEverything = name -> true;
+ final Map<String, Object> parameters = new HashMap<>();
+ parameters.put("allowedKey", "allowedValue");
+ parameters.put("blockedKey", "blockedValue");
+
+ pi.applyParameters(acceptsEverything, stack,
HttpParameters.create(parameters).build());
+
+ assertEquals(Map.of("allowedKey", "allowedValue"), actual);
+ }
+
public void testInsecureParameters() throws Exception {
// given
loadConfigurationProviders(new StrutsDefaultConfigurationProvider(),
new StrutsXmlConfigurationProvider("xwork-param-test.xml"));