shashank created CAMEL-26433:
--------------------------------
Summary: camel-hl7 - add a size limit to the HL7 MLLP MINA codec
(HL7MLLPCodec / HL7MLLPDecoder)
Key: CAMEL-26433
URL: https://issues.apache.org/jira/browse/CAMEL-26433
Project: Camel
Issue Type: Improvement
Components: camel-hl7, camel-mina
Reporter: shashank
Assignee: shashank
Follow-up of CAMEL-26090 (apache/camel#28758), mentioned in its review.
CAMEL-26090 adds {{maxFrameLength}} to the Netty decoder
({{HL7MLLPNettyDecoderFactory}}): a message longer than the limit, or more
bytes than the limit without the end bytes, fails with a
{{TooLongFrameException}} and the connection is closed. The MINA codec
({{HL7MLLPCodec}}, used as {{mina:tcp://...?codec=#hl7codec}}) has no limit:
{{HL7MLLPDecoder}} is a MINA {{CumulativeProtocolDecoder}}, which keeps the
bytes of a session in its buffer until it sees both end bytes. A client that
sends data without the end bytes makes the buffer of its session grow without
bound.
*Proposal*
* A {{maxFrameLength}} option on {{HL7MLLPCodec}} (stored in {{HL7MLLPConfig}},
which already has it since CAMEL-26090), default {{Integer.MAX_VALUE}} so
existing routes behave the same. When the bytes of the current message (from
the start byte, or from the start of the data, up to the end bytes) exceed it,
{{HL7MLLPDecoder.doDecode}} discards them up to the next end bytes and throws a
{{ProtocolDecoderException}} (MINA then calls the handler's
{{exceptionCaught}}, where the camel-mina consumer closes the session with a
WARN).
* The same semantics and wording as the Netty option, so the
{{hl7-dataformat.adoc}} options table can describe one {{maxFrameLength}} for
both codecs.
* Tests at the decoder level and with a real {{mina:tcp}} route, as for the
Netty decoder.
_Filed with Claude Code on behalf of allthingssecurity._
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)