diff --git a/core/src/main/java/com/opensymphony/xwork2/interceptor/ParametersInterceptor.java b/core/src/main/java/com/opensymphony/xwork2/interceptor/ParametersInterceptor.java index 3fa04220a0..ec0ded9c73 100644 --- a/core/src/main/java/com/opensymphony/xwork2/interceptor/ParametersInterceptor.java +++ b/core/src/main/java/com/opensymphony/xwork2/interceptor/ParametersInterceptor.java @@ -217,8 +217,8 @@ protected void setParameters(final Object action, ValueStack stack, HttpParamete //block or allow access to properties //see WW-2761 for more details MemberAccessValueStack accessValueStack = (MemberAccessValueStack) newStack; - accessValueStack.setAcceptProperties(acceptedPatterns.getAcceptedPatterns()); - accessValueStack.setExcludeProperties(excludedPatterns.getExcludedPatterns()); + accessValueStack.useAcceptProperties(acceptedPatterns.getAcceptedPatterns()); + accessValueStack.useExcludeProperties(excludedPatterns.getExcludedPatterns()); } for (Map.Entry entry : acceptableParameters.entrySet()) { diff --git a/core/src/main/java/com/opensymphony/xwork2/ognl/OgnlUtil.java b/core/src/main/java/com/opensymphony/xwork2/ognl/OgnlUtil.java index 827cda11a0..8c17902290 100644 --- a/core/src/main/java/com/opensymphony/xwork2/ognl/OgnlUtil.java +++ b/core/src/main/java/com/opensymphony/xwork2/ognl/OgnlUtil.java @@ -872,22 +872,22 @@ protected Map createDefaultContext(Object root, ClassResolver cl } SecurityMemberAccess memberAccess = new SecurityMemberAccess(allowStaticFieldAccess); - memberAccess.setDisallowProxyMemberAccess(disallowProxyMemberAccess); + memberAccess.disallowProxyMemberAccess(disallowProxyMemberAccess); if (devMode) { if (!warnReported.get()) { warnReported.set(true); LOG.warn("Working in devMode, using devMode excluded classes and packages!"); } - memberAccess.setExcludedClasses(devModeExcludedClasses); - memberAccess.setExcludedPackageNamePatterns(devModeExcludedPackageNamePatterns); - memberAccess.setExcludedPackageNames(devModeExcludedPackageNames); - memberAccess.setExcludedPackageExemptClasses(devModeExcludedPackageExemptClasses); + memberAccess.useExcludedClasses(devModeExcludedClasses); + memberAccess.useExcludedPackageNamePatterns(devModeExcludedPackageNamePatterns); + memberAccess.useExcludedPackageNames(devModeExcludedPackageNames); + memberAccess.useExcludedPackageExemptClasses(devModeExcludedPackageExemptClasses); } else { - memberAccess.setExcludedClasses(excludedClasses); - memberAccess.setExcludedPackageNamePatterns(excludedPackageNamePatterns); - memberAccess.setExcludedPackageNames(excludedPackageNames); - memberAccess.setExcludedPackageExemptClasses(excludedPackageExemptClasses); + memberAccess.useExcludedClasses(excludedClasses); + memberAccess.useExcludedPackageNamePatterns(excludedPackageNamePatterns); + memberAccess.useExcludedPackageNames(excludedPackageNames); + memberAccess.useExcludedPackageExemptClasses(excludedPackageExemptClasses); } return Ognl.createDefaultContext(root, memberAccess, resolver, defaultConverter); diff --git a/core/src/main/java/com/opensymphony/xwork2/ognl/OgnlValueStack.java b/core/src/main/java/com/opensymphony/xwork2/ognl/OgnlValueStack.java index 938ed477ae..336312c897 100644 --- a/core/src/main/java/com/opensymphony/xwork2/ognl/OgnlValueStack.java +++ b/core/src/main/java/com/opensymphony/xwork2/ognl/OgnlValueStack.java @@ -89,11 +89,11 @@ protected OgnlValueStack(ValueStack vs, XWorkConverter xworkConverter, CompoundR @Inject protected void setOgnlUtil(OgnlUtil ognlUtil) { this.ognlUtil = ognlUtil; - securityMemberAccess.setExcludedClasses(ognlUtil.getExcludedClasses()); - securityMemberAccess.setExcludedPackageNamePatterns(ognlUtil.getExcludedPackageNamePatterns()); - securityMemberAccess.setExcludedPackageNames(ognlUtil.getExcludedPackageNames()); - securityMemberAccess.setExcludedPackageExemptClasses(ognlUtil.getExcludedPackageExemptClasses()); - securityMemberAccess.setDisallowProxyMemberAccess(ognlUtil.isDisallowProxyMemberAccess()); + securityMemberAccess.useExcludedClasses(ognlUtil.getExcludedClasses()); + securityMemberAccess.useExcludedPackageNamePatterns(ognlUtil.getExcludedPackageNamePatterns()); + securityMemberAccess.useExcludedPackageNames(ognlUtil.getExcludedPackageNames()); + securityMemberAccess.useExcludedPackageExemptClasses(ognlUtil.getExcludedPackageExemptClasses()); + securityMemberAccess.disallowProxyMemberAccess(ognlUtil.isDisallowProxyMemberAccess()); } protected void setRoot(XWorkConverter xworkConverter, CompoundRootAccessor accessor, CompoundRoot compoundRoot, boolean allowStaticFieldAccess) { @@ -482,12 +482,22 @@ public void clearContextValues() { ((OgnlContext) context).getValues().clear(); } + @Deprecated public void setAcceptProperties(Set acceptedProperties) { - securityMemberAccess.setAcceptProperties(acceptedProperties); + securityMemberAccess.useAcceptProperties(acceptedProperties); } + public void useAcceptProperties(Set acceptedProperties) { + securityMemberAccess.useAcceptProperties(acceptedProperties); + } + + @Deprecated public void setExcludeProperties(Set excludeProperties) { - securityMemberAccess.setExcludeProperties(excludeProperties); + securityMemberAccess.useExcludeProperties(excludeProperties); + } + + public void useExcludeProperties(Set excludeProperties) { + securityMemberAccess.useExcludeProperties(excludeProperties); } @Inject diff --git a/core/src/main/java/com/opensymphony/xwork2/ognl/SecurityMemberAccess.java b/core/src/main/java/com/opensymphony/xwork2/ognl/SecurityMemberAccess.java index c21b5b089e..18acc675c0 100644 --- a/core/src/main/java/com/opensymphony/xwork2/ognl/SecurityMemberAccess.java +++ b/core/src/main/java/com/opensymphony/xwork2/ognl/SecurityMemberAccess.java @@ -299,31 +299,87 @@ protected boolean isExcluded(String paramName) { return false; } + /** + * @deprecated please use {@link #useExcludeProperties(Set)} + */ + @Deprecated public void setExcludeProperties(Set excludeProperties) { this.excludeProperties = excludeProperties; } + public void useExcludeProperties(Set excludeProperties) { + this.excludeProperties = excludeProperties; + } + + /** + * @deprecated please use {@link #useAcceptProperties(Set)} + */ + @Deprecated public void setAcceptProperties(Set acceptedProperties) { this.acceptProperties = acceptedProperties; } + public void useAcceptProperties(Set acceptedProperties) { + this.acceptProperties = acceptedProperties; + } + + /** + * @deprecated please use {@link #useExcludedClasses(Set)} + */ + @Deprecated public void setExcludedClasses(Set> excludedClasses) { this.excludedClasses = excludedClasses; } + public void useExcludedClasses(Set> excludedClasses) { + this.excludedClasses = excludedClasses; + } + + /** + * @deprecated please use {@link #useExcludedPackageNamePatterns(Set)} + */ + @Deprecated public void setExcludedPackageNamePatterns(Set excludedPackageNamePatterns) { this.excludedPackageNamePatterns = excludedPackageNamePatterns; } + public void useExcludedPackageNamePatterns(Set excludedPackageNamePatterns) { + this.excludedPackageNamePatterns = excludedPackageNamePatterns; + } + + /** + * @deprecated please use {@link #useExcludedPackageNames(Set)} + */ + @Deprecated public void setExcludedPackageNames(Set excludedPackageNames) { this.excludedPackageNames = excludedPackageNames; } + public void useExcludedPackageNames(Set excludedPackageNames) { + this.excludedPackageNames = excludedPackageNames; + } + + /** + * @deprecated please use {@link #useExcludedPackageExemptClasses(Set)} + */ + @Deprecated public void setExcludedPackageExemptClasses(Set> excludedPackageExemptClasses) { this.excludedPackageExemptClasses = excludedPackageExemptClasses; } + public void useExcludedPackageExemptClasses(Set> excludedPackageExemptClasses) { + this.excludedPackageExemptClasses = excludedPackageExemptClasses; + } + + /** + * @deprecated please use {@link #disallowProxyMemberAccess(boolean)} + */ + @Deprecated public void setDisallowProxyMemberAccess(boolean disallowProxyMemberAccess) { this.disallowProxyMemberAccess = disallowProxyMemberAccess; } + + public void disallowProxyMemberAccess(boolean disallowProxyMemberAccess) { + this.disallowProxyMemberAccess = disallowProxyMemberAccess; + } } diff --git a/core/src/main/java/com/opensymphony/xwork2/util/MemberAccessValueStack.java b/core/src/main/java/com/opensymphony/xwork2/util/MemberAccessValueStack.java index 801c24573b..86b39f480b 100644 --- a/core/src/main/java/com/opensymphony/xwork2/util/MemberAccessValueStack.java +++ b/core/src/main/java/com/opensymphony/xwork2/util/MemberAccessValueStack.java @@ -27,8 +27,20 @@ */ public interface MemberAccessValueStack { + /** + * @deprecated please use {@link #useExcludeProperties(Set)} + */ + @Deprecated void setExcludeProperties(Set excludeProperties); + void useExcludeProperties(Set excludeProperties); + + /** + * @deprecated please use {@link #useAcceptProperties(Set)} + */ + @Deprecated void setAcceptProperties(Set acceptedProperties); + void useAcceptProperties(Set acceptedProperties); + } diff --git a/core/src/main/resources/struts-excluded-classes.xml b/core/src/main/resources/struts-excluded-classes.xml index 524194af9a..294e2399b9 100644 --- a/core/src/main/resources/struts-excluded-classes.xml +++ b/core/src/main/resources/struts-excluded-classes.xml @@ -2,19 +2,19 @@