[ 
https://issues.apache.org/jira/browse/CAMEL-26585?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andrea Cosentino reassigned CAMEL-26585:
----------------------------------------

    Assignee: Andrea Cosentino

> camel-aws2-sns - escape string members of array attributes
> ----------------------------------------------------------
>
>                 Key: CAMEL-26585
>                 URL: https://issues.apache.org/jira/browse/CAMEL-26585
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-aws2
>            Reporter: Andrea Cosentino
>            Assignee: Andrea Cosentino
>            Priority: Major
>
> `components/camel-aws/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Producer.java:155`
> ```java
> String resultString = ((List<?>) value).stream()
>         .map(o -> o instanceof String ? String.format("\"%s\"", o) : 
> Objects.toString(o))
>         .collect(Collectors.joining(", "));
> ```
> Wrapping text in quotation marks does not JSON-escape it. A member containing 
> a quote produces malformed JSON; backslashes and control characters also fail 
> to round-trip. Use proper JSON serialization while preserving supported 
> numbers, booleans and nulls. SnsProducerTest currently covers plain strings 
> and primitive values, not escaped strings.
> History: array handling dates to 2020; no recent fix addresses escaping.
> [AWS SNS 
> documentation](https://docs.aws.amazon.com/sns/latest/dg/sns-message-attributes.html)
>  requires valid JSON for attributes used in subscription filtering.
> Expected behavior: the operation honors its documented contract, including 
> exceptional and terminal paths. Add regression tests for the triggering case 
> described above.
> Audited against upstream main 3658e02a7f9d. AI-generated by Codex on behalf 
> of oscerd (JIRA acosentino).



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to