Andrea Cosentino created CAMEL-24238:
----------------------------------------
Summary: camel-aws2-ses: a RawMessage body is sent as the SdkBytes
descriptor instead of the message content
Key: CAMEL-24238
URL: https://issues.apache.org/jira/browse/CAMEL-24238
Project: Camel
Issue Type: Bug
Components: camel-aws
Reporter: Andrea Cosentino
Assignee: Andrea Cosentino
Fix For: 4.14.9, 4.22.0, 4.18.4
Ses2Producer.createMessage extracts the text of an AWS RawMessage body with
toString() on the SdkBytes payload:
{code:java}
if (exchange.getIn().getBody() instanceof RawMessage raw) {
content = raw.data().toString();
}
{code}
SdkBytes.toString() is a debug descriptor, not the payload. Verified against
the SDK:
{noformat}
toString() ->
SdkBytes(bytes=0x46726f6d3a206140622e636f6d0d0a5375626a6563743a2068690d0a0d0a626f6479)
asUtf8String() -> From: [email protected]\r\nSubject: hi\r\n\r\nbody
{noformat}
So when the message body is an AWS RawMessage and the exchange takes the
non-raw path (the raw path is only taken for a jakarta.mail.Message body), the
email is sent with a literal "SdkBytes(bytes=0x...)" hex descriptor as its
content instead of the intended text.
Fix: read the payload with SdkBytes.asUtf8String().
Code reference (main): Ses2Producer.java ~line 104.
Present on camel-4.18.x and camel-4.14.x; backport to both.
Found during an agent-assisted audit of the AWS components.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)