[backport camel-4.18.x] CAMEL-23461: camel-aws-bedrock - applyGuardrail reads guardrail identifier from wrong header#23161
Open
oscerd wants to merge 1 commit into
Conversation
…ifier from wrong header (apache#23151) The applyGuardrail producer was reading the guardrail identifier from CamelAwsBedrockGuardrailConfig as a String, but that header is documented as GuardrailConfiguration and is consumed as such by converse / converseStream. Routes mixing the two operations silently produced a null identifier and fell back to the endpoint configuration only. Introduce a dedicated CamelAwsBedrockGuardrailIdentifier header (BedrockConstants.GUARDRAIL_IDENTIFIER, typed String) for applyGuardrail. GUARDRAIL_CONFIG stays reserved for converse / converseStream. Adds a unit test (mocked BedrockRuntimeClient, no AWS access required) covering endpoint fallback, the new header, the regression where GUARDRAIL_CONFIG must not corrupt the applyGuardrail request, and the missing-identifier failure path. Component docs, the 4.21 upgrade guide, and the regenerated catalog/metadata/endpoint-DSL artifacts are updated accordingly. Closes apache#23151
davsclaus
approved these changes
May 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of #23151
Cherry-pick of #23151 onto
camel-4.18.x.Original PR: #23151 - CAMEL-23461: camel-aws-bedrock - applyGuardrail reads guardrail identifier from wrong header
Original author: @oscerd
Target branch:
camel-4.18.xBackport notes
camel-4x-upgrade-guide-4_21.adoc(only on main) tocamel-4x-upgrade-guide-4_18.adocunder theUpgrading from 4.18.2 to 4.18.3section.mockito-junit-jupiterwas added as a test-scoped dependency oncamel-aws-bedrockbecause the module did not already declare it on 4.18.x (other AWS components likecamel-aws2-sns/-sqs/-athenaalready use the same${mockito-version}from the parent pom).camel-4x-upgrade-guide-4_18.adocentry will be added tomainin a follow-up doc-sync PR so the main upgrade-guide history stays consistent with what ships on 4.18.x.Original description
The
applyGuardrailproducer operation was reading the guardrail identifier fromCamelAwsBedrockGuardrailConfigas aString, but that header is documented asGuardrailConfigurationand is consumed as such byconverse/converseStream. Routes mixing the two operations silently produced anullidentifier and fell back to the endpoint configuration only.A dedicated
CamelAwsBedrockGuardrailIdentifierheader (BedrockConstants.GUARDRAIL_IDENTIFIER, typedString) is introduced forapplyGuardrail.GUARDRAIL_CONFIGstays reserved forconverse/converseStream.Unit test added (mocked
BedrockRuntimeClient, no AWS access required) covering endpoint fallback, the new header, the regression whereGUARDRAIL_CONFIGmust not corrupt theapplyGuardrailrequest, and the missing-identifier failure path.JIRA: https://issues.apache.org/jira/browse/CAMEL-23461
Claude Code on behalf of Andrea Cosentino.