coheigea commented on code in PR #3721:
URL: https://github.com/apache/cxf/pull/3721#discussion_r4586640962
##########
rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/encoded/SoapArrayType.java:
##########
@@ -39,15 +39,29 @@
import org.apache.cxf.aegis.xml.MessageWriter;
import org.apache.cxf.binding.soap.Soap11;
import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.common.util.SystemPropertyAction;
import org.apache.cxf.helpers.CastUtils;
+import org.apache.cxf.message.Message;
import org.apache.ws.commons.schema.XmlSchema;
import static
org.apache.cxf.aegis.type.encoded.SoapEncodingUtil.readAttributeValue;
public class SoapArrayType extends AegisType {
+ /**
+ * The maximum total number of elements of the SOAP encoded arrays read
from a message. Each array is
+ * created at the size declared in its arrayType attribute, however many
elements are actually sent,
+ * so this limits the memory a message can make the service allocate. The
default is 1000000, and a
+ * negative value means no limit. It can be set as a message (endpoint or
client) property, or as a
+ * system property.
+ */
+ public static final String MAX_ARRAY_ELEMENTS =
"org.apache.cxf.aegis.encoded.maxArrayElements";
Review Comment:
Thanks. Agreed that the single property is hard to reason about. The problem
with limiting the number of arrays plus the elements per array is that the
worst case is their product (e.g. 100 arrays × 1M elements), so it no longer
bounds the memory a message can make us allocate. It would also reject
legitimate messages with many small arrays. How about mirroring the StAX limits
(maxChildElements/maxElementCount) instead: maxArrayElements for the declared
size of a single array, plus maxTotalArrayElements for the total across the
message? The first is the intuitive one, and the second keeps the memory bound.
--
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]