CAMEL-23592: camel-itest - update ShiroOverJmsTest for renamed Shiro security headers#23592
Merged
Merged
Conversation
…security headers After CAMEL-23592 the three Shiro security headers (SHIRO_SECURITY_TOKEN, SHIRO_SECURITY_USERNAME, SHIRO_SECURITY_PASSWORD) carry their value in the Camel* namespace (CamelShiroSecurityToken etc.). The default JmsHeaderFilterStrategy filters every Camel* header at the transport boundary, which is the intended behavior for untrusted producers but strips the serialized authentication token from trusted Shiro-over-JMS routes that previously relied on the old non-Camel-prefixed value surviving the JMS round-trip. ShiroOverJmsTest demonstrates the Shiro-over-JMS pattern and started failing because the consumer-side policy could no longer read the token from the message: the failed message went to the dead-letter mock (expected 0, was 1). The test was passing on main only because its incremental-build scope did not exercise camel-itest after the rename; the regression is latent on main too. - ShiroOverJmsTest: configure a small subclass of JmsHeaderFilterStrategy on the JMS component that opts the three Shiro security headers back in (returns false from applyFilterToCamelHeaders / applyFilterToExternalHeaders for those headers and delegates to super for everything else). This is the pattern end-users will need. - 4.21 upgrade guide: extend the camel-shiro entry to document the new required HeaderFilterStrategy opt-in for trusted Shiro-over-transport routes, with a worked code example mirroring the one used in the test. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Signed-off-by: Andrea Cosentino <ancosen@gmail.com>
apupier
approved these changes
May 28, 2026
davsclaus
approved these changes
May 28, 2026
Contributor
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
oscerd
added a commit
to oscerd/camel
that referenced
this pull request
May 28, 2026
…security headers After CAMEL-23592 the three Shiro security header values move into the Camel* namespace (CamelShiroSecurityToken etc.). The default JmsHeaderFilterStrategy filters every Camel* header at the transport boundary, which is the intended behavior for untrusted producers but strips the serialized authentication token from trusted Shiro-over-JMS routes that previously relied on the old non-Camel-prefixed value surviving the JMS round-trip. ShiroOverJmsTest is exactly such a trusted Shiro-over-JMS route and started failing on this backport branch's CI: mock://ShiroOverJmsTestError Received message count. Expected: <0> but was: <1> (the consumer-side ShiroSecurityPolicy could no longer read the token and the message ended up at the dead-letter mock). The same regression exists latently on main; the matching fix is in PR apache#23592. - ShiroOverJmsTest: configure a small subclass of JmsHeaderFilterStrategy on the JMS component that opts the three Shiro security headers back in (returns false from applyFilterToCamelHeaders / applyFilterToExternalHeaders for those headers, delegates to super for everything else). This is the pattern end-users will need. - 4.18 upgrade guide: extend the camel-shiro entry to document the new required HeaderFilterStrategy opt-in for trusted Shiro-over-transport routes, with a worked code example mirroring the one used in the test. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Signed-off-by: Andrea Cosentino <ancosen@gmail.com>
3 tasks
Contributor
|
🧪 CI tested the following changed modules:
|
oscerd
added a commit
to oscerd/camel
that referenced
this pull request
May 28, 2026
…security headers After CAMEL-23592 the three Shiro security header values move into the Camel* namespace (CamelShiroSecurityToken etc.). The default JmsHeaderFilterStrategy filters every Camel* header at the transport boundary, which is the intended behavior for untrusted producers but strips the serialized authentication token from trusted Shiro-over-JMS routes that previously relied on the old non-Camel-prefixed value surviving the JMS round-trip. ShiroOverJmsTest is exactly such a trusted Shiro-over-JMS route and was failing on this backport branch's CI: mock://ShiroOverJmsTestError Received message count. Expected: <0> but was: <1> (the consumer-side ShiroSecurityPolicy could no longer read the token and the message ended up at the dead-letter mock). The same regression exists latently on main; the matching fix is in PR apache#23592, and PR apache#23552 applies it to the 4.18.x backport. - ShiroOverJmsTest: configure a small subclass of JmsHeaderFilterStrategy on the JMS component that opts the three Shiro security headers back in (returns false from applyFilterToCamelHeaders / applyFilterToExternalHeaders for those headers, delegates to super for everything else). This is the pattern end-users will need. - 4.14 upgrade guide: extend the camel-shiro entry to document the new required HeaderFilterStrategy opt-in for trusted Shiro-over-transport routes, with a worked code example mirroring the one used in the test. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Signed-off-by: Andrea Cosentino <ancosen@gmail.com>
3 tasks
Contributor
|
merging as it is fixing main branch |
oscerd
added a commit
that referenced
this pull request
May 28, 2026
…der constant names with Camel naming convention (#23552) * CAMEL-23592: camel-shiro - align Exchange header constant names with Camel naming convention (#23506) Renames the three Exchange header string values in ShiroSecurityConstants that drive Shiro authentication (SHIRO_SECURITY_TOKEN, SHIRO_SECURITY_USERNAME, SHIRO_SECURITY_PASSWORD) to CamelShiroSecurity<Name>, following the convention used across the rest of the Camel component catalog and matching the pattern established in CAMEL-23526 (camel-cxf), CAMEL-23522 (camel-mail), CAMEL-23461 (camel-aws-bedrock), CAMEL-23532 (camel-vertx-websocket / camel-atmosphere-websocket / camel-iggy), and CAMEL-23576 (camel-jira). - SHIRO_SECURITY_TOKEN: "SHIRO_SECURITY_TOKEN" -> "CamelShiroSecurityToken" - SHIRO_SECURITY_USERNAME: "SHIRO_SECURITY_USERNAME" -> "CamelShiroSecurityUsername" - SHIRO_SECURITY_PASSWORD: "SHIRO_SECURITY_PASSWORD" -> "CamelShiroSecurityPassword" These headers carry credentials and a serialized authentication token, so filtering them at transport boundaries by default is particularly important. The Java field names are unchanged so routes referencing the constants symbolically continue to work; routes using the literal string values must be updated (documented in the 4.21 upgrade guide). No tests reference the literal values, and the shiro adoc documentation references the constants symbolically. Tracker: CAMEL-23577 Reported by Claude Code on behalf of Andrea Cosentino Signed-off-by: Andrea Cosentino <ancosen@gmail.com> * CAMEL-23592: camel-itest - update ShiroOverJmsTest for renamed Shiro security headers After CAMEL-23592 the three Shiro security header values move into the Camel* namespace (CamelShiroSecurityToken etc.). The default JmsHeaderFilterStrategy filters every Camel* header at the transport boundary, which is the intended behavior for untrusted producers but strips the serialized authentication token from trusted Shiro-over-JMS routes that previously relied on the old non-Camel-prefixed value surviving the JMS round-trip. ShiroOverJmsTest is exactly such a trusted Shiro-over-JMS route and started failing on this backport branch's CI: mock://ShiroOverJmsTestError Received message count. Expected: <0> but was: <1> (the consumer-side ShiroSecurityPolicy could no longer read the token and the message ended up at the dead-letter mock). The same regression exists latently on main; the matching fix is in PR #23592. - ShiroOverJmsTest: configure a small subclass of JmsHeaderFilterStrategy on the JMS component that opts the three Shiro security headers back in (returns false from applyFilterToCamelHeaders / applyFilterToExternalHeaders for those headers, delegates to super for everything else). This is the pattern end-users will need. - 4.18 upgrade guide: extend the camel-shiro entry to document the new required HeaderFilterStrategy opt-in for trusted Shiro-over-transport routes, with a worked code example mirroring the one used in the test. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Signed-off-by: Andrea Cosentino <ancosen@gmail.com> --------- Signed-off-by: Andrea Cosentino <ancosen@gmail.com> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
oscerd
added a commit
to oscerd/camel
that referenced
this pull request
May 28, 2026
…security headers After CAMEL-23592 the three Shiro security header values move into the Camel* namespace (CamelShiroSecurityToken etc.). The default JmsHeaderFilterStrategy filters every Camel* header at the transport boundary, which is the intended behavior for untrusted producers but strips the serialized authentication token from trusted Shiro-over-JMS routes that previously relied on the old non-Camel-prefixed value surviving the JMS round-trip. ShiroOverJmsTest is exactly such a trusted Shiro-over-JMS route and was failing on this backport branch's CI: mock://ShiroOverJmsTestError Received message count. Expected: <0> but was: <1> (the consumer-side ShiroSecurityPolicy could no longer read the token and the message ended up at the dead-letter mock). The same regression exists latently on main; the matching fix is in PR apache#23592, and PR apache#23552 applies it to the 4.18.x backport. - ShiroOverJmsTest: configure a small subclass of JmsHeaderFilterStrategy on the JMS component that opts the three Shiro security headers back in (returns false from applyFilterToCamelHeaders / applyFilterToExternalHeaders for those headers, delegates to super for everything else). This is the pattern end-users will need. - 4.14 upgrade guide: extend the camel-shiro entry to document the new required HeaderFilterStrategy opt-in for trusted Shiro-over-transport routes, with a worked code example mirroring the one used in the test. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Signed-off-by: Andrea Cosentino <ancosen@gmail.com>
oscerd
added a commit
that referenced
this pull request
May 28, 2026
…der constant names with Camel naming convention (#23559) * CAMEL-23592: camel-shiro - align Exchange header constant names with Camel naming convention (#23506) Renames the three Exchange header string values in ShiroSecurityConstants that drive Shiro authentication (SHIRO_SECURITY_TOKEN, SHIRO_SECURITY_USERNAME, SHIRO_SECURITY_PASSWORD) to CamelShiroSecurity<Name>, following the convention used across the rest of the Camel component catalog and matching the pattern established in CAMEL-23526 (camel-cxf), CAMEL-23522 (camel-mail), CAMEL-23461 (camel-aws-bedrock), CAMEL-23532 (camel-vertx-websocket / camel-atmosphere-websocket / camel-iggy), and CAMEL-23576 (camel-jira). - SHIRO_SECURITY_TOKEN: "SHIRO_SECURITY_TOKEN" -> "CamelShiroSecurityToken" - SHIRO_SECURITY_USERNAME: "SHIRO_SECURITY_USERNAME" -> "CamelShiroSecurityUsername" - SHIRO_SECURITY_PASSWORD: "SHIRO_SECURITY_PASSWORD" -> "CamelShiroSecurityPassword" These headers carry credentials and a serialized authentication token, so filtering them at transport boundaries by default is particularly important. The Java field names are unchanged so routes referencing the constants symbolically continue to work; routes using the literal string values must be updated (documented in the 4.21 upgrade guide). No tests reference the literal values, and the shiro adoc documentation references the constants symbolically. Tracker: CAMEL-23577 Reported by Claude Code on behalf of Andrea Cosentino Signed-off-by: Andrea Cosentino <ancosen@gmail.com> * CAMEL-23592: camel-itest - update ShiroOverJmsTest for renamed Shiro security headers After CAMEL-23592 the three Shiro security header values move into the Camel* namespace (CamelShiroSecurityToken etc.). The default JmsHeaderFilterStrategy filters every Camel* header at the transport boundary, which is the intended behavior for untrusted producers but strips the serialized authentication token from trusted Shiro-over-JMS routes that previously relied on the old non-Camel-prefixed value surviving the JMS round-trip. ShiroOverJmsTest is exactly such a trusted Shiro-over-JMS route and was failing on this backport branch's CI: mock://ShiroOverJmsTestError Received message count. Expected: <0> but was: <1> (the consumer-side ShiroSecurityPolicy could no longer read the token and the message ended up at the dead-letter mock). The same regression exists latently on main; the matching fix is in PR #23592, and PR #23552 applies it to the 4.18.x backport. - ShiroOverJmsTest: configure a small subclass of JmsHeaderFilterStrategy on the JMS component that opts the three Shiro security headers back in (returns false from applyFilterToCamelHeaders / applyFilterToExternalHeaders for those headers, delegates to super for everything else). This is the pattern end-users will need. - 4.14 upgrade guide: extend the camel-shiro entry to document the new required HeaderFilterStrategy opt-in for trusted Shiro-over-transport routes, with a worked code example mirroring the one used in the test. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Signed-off-by: Andrea Cosentino <ancosen@gmail.com> --------- Signed-off-by: Andrea Cosentino <ancosen@gmail.com> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Motivation
CAMEL-23592 (#23506) renamed three
ShiroSecurityConstantsheader values fromnon-Camel-prefixed (
SHIRO_SECURITY_TOKEN,SHIRO_SECURITY_USERNAME,SHIRO_SECURITY_PASSWORD) into the canonical Camel prefix(
CamelShiroSecurityTokenetc.). The intent — quoting the upgrade-guide entry — isthat "these headers carry credentials and a serialized authentication token, so
filtering them at transport boundaries by default is particularly important."
The default
JmsHeaderFilterStrategy(and similarly for CXF/HTTP) filters everyCamel*header (case-insensitive) on both inbound and outbound. So with the rename,a trusted Shiro-over-JMS route that was passing the serialized token through JMS
suddenly loses that token at the JMS producer, the consumer-side
ShiroSecurityPolicysees no token, throws an authentication failure exception, and the message lands on
the dead-letter mock.
ShiroOverJmsTestincamel-itestis exactly this pattern and started failing onthe 4.18.x backport PR (#23552):
The same regression is latent on main: CAMEL-23592 merged earlier today
(commit aeb5fd9d) and the post-merge
main CI run reported
success, but its incremental-build only ran tests for
camel-shiroitself —camel-itestwas built but its tests were not executed. Anyone running
mvn -pl tests/camel-itest test -Dtest=ShiroOverJmsTestonmainwill reproducethe same failure.
What this changes
This PR keeps the rename (the underlying security improvement) but updates the
integration test, and documents the new opt-in pattern users need to apply.
ShiroOverJmsTestAdds a small subclass of
JmsHeaderFilterStrategy(private to the test) that optsthe three Shiro security headers back through the transport boundary while leaving
every other
Camel*-prefixed filter rule untouched:This demonstrates the exact configuration end-users need to keep Shiro-over-JMS
routes working post-CAMEL-23592.
4.21 upgrade guide
Extends the existing
=== camel-shiro - potential breaking changeentry with thenew HeaderFilterStrategy opt-in pattern and a worked code example. Points to
ShiroOverJmsTestas a worked example.Compatibility
regen needed.
specific named headers — the default filter still blocks every other
Camel*header at the JMS boundary.
Test plan
mvn -pl tests/camel-itest test -Dtest=ShiroOverJmsTestpasses locally(was failing on the 4.18.x backport without this change).
mvn clean install -DskipTests.git statuspost-build).Follow-on
Once merged on
main, the same fix needs to be cherry-picked into thein-flight backport PRs:
to
camel-4.18.x(currently red on this exact test).camel-4.14.x(when CAMEL-23592 is backported there).Related
Claude Code on behalf of Andrea Cosentino