[
https://issues.apache.org/jira/browse/CAMEL-23461?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18080308#comment-18080308
]
Andrea Cosentino commented on CAMEL-23461:
------------------------------------------
Need to backport on 4.18.x
> Camel-AWS-Bedrock: applyGuardrail reads guardrail identifier from wrong header
> ------------------------------------------------------------------------------
>
> Key: CAMEL-23461
> URL: https://issues.apache.org/jira/browse/CAMEL-23461
> Project: Camel
> Issue Type: Bug
> Reporter: Andrea Cosentino
> Assignee: Andrea Cosentino
> Priority: Major
> Fix For: 4.18.3, 4.21.0
>
>
> The {{applyGuardrail}} operation in {{BedrockProducer}} reads the guardrail
> identifier from the {{GUARDRAIL_CONFIG}} header as a {{String}}:
> {code:java}
> String guardrailIdentifier =
> exchange.getMessage().getHeader(BedrockConstants.GUARDRAIL_CONFIG,
> String.class);
> {code}
> However, {{GUARDRAIL_CONFIG}} is documented in {{BedrockConstants}} as a
> {{GuardrailConfiguration}} (used by the {{converse}} and {{converseStream}}
> operations). When a route uses both {{converse}} and {{applyGuardrail}},
> setting one header type collides with the other and the cast silently
> produces {{null}}.
> *Files:*
> *
> {{components/camel-aws/camel-aws-bedrock/src/main/java/org/apache/camel/component/aws2/bedrock/runtime/BedrockProducer.java:809}}
> *
> {{components/camel-aws/camel-aws-bedrock/src/main/java/org/apache/camel/component/aws2/bedrock/runtime/BedrockConstants.java:57}}
> *Suggested fix:*
> * Add a new constant {{GUARDRAIL_IDENTIFIER}} (typed {{String}}) for
> {{applyGuardrail}}.
> * Read the {{applyGuardrail}} identifier from {{GUARDRAIL_IDENTIFIER}} rather
> than {{GUARDRAIL_CONFIG}}.
> * Keep {{GUARDRAIL_CONFIG}} as {{GuardrailConfiguration}} for converse
> operations.
> ----
> _Filed by Claude Code on behalf of Andrea Cosentino._
--
This message was sent by Atlassian Jira
(v8.20.10#820010)