Skip to content

[backport camel-4.18.x] CAMEL-23630: add HeaderFilterStrategy to camel-dapr#23889

Merged
oscerd merged 1 commit into
apache:camel-4.18.xfrom
oscerd:backport/23886-to-camel-4.18.x
Jun 10, 2026
Merged

[backport camel-4.18.x] CAMEL-23630: add HeaderFilterStrategy to camel-dapr#23889
oscerd merged 1 commit into
apache:camel-4.18.xfrom
oscerd:backport/23886-to-camel-4.18.x

Conversation

@oscerd

@oscerd oscerd commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Backport of #23886

Cherry-pick of #23886 (squash commit 72d13bd13fb) onto camel-4.18.x.

What this backports

Adds DaprHeaderFilterStrategy (exposed via DaprComponent / DaprEndpoint as the standard headerFilterStrategy option) and stops the dapr-pubsub consumer from copying the inbound CloudEvent's pubsubName / topic into the CamelDaprPubSubName / CamelDaprTopic headers. Those two constants are producer-direction routing headers that DaprConfigurationOptionsProxy reads back and prefers over the endpoint-configured destination, so a from(dapr-pubsub).to(dapr-pubsub) route incorrectly carried the inbound destination into the producer hop. The remaining CloudEvent metadata headers are unchanged.

Backport notes

  • Upgrade-guide entry omitted by design. The original PR added a note to camel-4x-upgrade-guide-4_21.adoc, which does not exist on camel-4.18.x. Per project policy, upgrade-guide entries live on main; a matching camel-4x-upgrade-guide-4_18.adoc entry on main will follow so the 4.18.x line is documented.
  • Clean cherry-pick: all 12 code/generated files applied without conflict; only the 4_21 upgrade-guide hunk was dropped.
  • Validated locally: mvn -pl components/camel-dapr clean install on a camel-4.18.x worktree — BUILD SUCCESS, 52 tests pass (incl. DaprPubSubConsumerTest), no regenerated-file drift.

Backport prepared by Claude Code on behalf of Andrea Cosentino · 🤖 Generated with Claude Code

Adds a DaprHeaderFilterStrategy (extending DefaultHeaderFilterStrategy) exposed via
DaprComponent / DaprEndpoint as the standard headerFilterStrategy option, aligning
camel-dapr with the rest of the messaging-component family (camel-iggy, camel-kafka,
camel-jms).

The dapr-pubsub consumer no longer copies the inbound CloudEvent's pubsubName / topic
into the CamelDaprPubSubName / CamelDaprTopic headers. Those two constants are
producer-direction routing headers that DaprConfigurationOptionsProxy reads back and
prefers over the endpoint-configured destination, so a from(dapr-pubsub).to(dapr-pubsub)
route incorrectly carried the inbound destination into the producer hop. The remaining
CloudEvent metadata headers are unchanged. Documented in the 4.21 upgrade guide.

(cherry picked from commit 72d13bd)
@oscerd oscerd added the backport indicate that a Pull request is a backport from a fix from the main branch label Jun 9, 2026
@oscerd oscerd requested a review from davsclaus June 9, 2026 15:50

@gnodet gnodet left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good backport adding DaprHeaderFilterStrategy to the camel-dapr component for 4.18.x. The changes correctly:

  1. Add a DaprHeaderFilterStrategy class that filters Camel-internal headers (Camel*, camel*) in both directions, plus breadcrumbId
  2. Add a headerFilterStrategy endpoint option so users can customize filtering
  3. Apply the filter in DaprConsumer.createExchange() when mapping Dapr metadata to Camel headers
  4. Apply the filter in DaprProducer when mapping Camel headers to Dapr metadata
  5. Include tests validating the filtering behavior
  6. Update generated catalog/configurer files

This is an important security hardening — it prevents external Dapr message producers from injecting Camel-internal headers via Dapr metadata.

Fully automatic review from Claude Code

@oscerd oscerd merged commit 86276a2 into apache:camel-4.18.x Jun 10, 2026
3 checks passed
oscerd added a commit that referenced this pull request Jun 10, 2026
…de guide (#23891)

The dapr-pubsub consumer header change (CAMEL-23630) was backported to
camel-4.18.x (#23889) and ships in 4.18.3. Per the backport upgrade-guide
policy, document it in camel-4x-upgrade-guide-4_18.adoc on main (the canonical
upgrade-guide history), mirroring the existing 4_21 entry.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@oscerd oscerd deleted the backport/23886-to-camel-4.18.x branch June 10, 2026 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport indicate that a Pull request is a backport from a fix from the main branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants