Skip to content

Add inbound header filtering to CXF and Knative filter strategies#22413

Open
Croway wants to merge 1 commit intoapache:mainfrom
Croway:fix-header-filter-inbound-consistency
Open

Add inbound header filtering to CXF and Knative filter strategies#22413
Croway wants to merge 1 commit intoapache:mainfrom
Croway:fix-header-filter-inbound-consistency

Conversation

@Croway
Copy link
Copy Markdown
Contributor

@Croway Croway commented Apr 2, 2026

Summary

  • Align CxfRsHeaderFilterStrategy, CxfHeaderFilterStrategy and KnativeHttpHeaderFilterStrategy with HttpHeaderFilterStrategy by adding setInFilterStartsWith(CAMEL_FILTER_STARTS_WITH) so that internal headers are filtered in both directions.

Test plan

  • mvn verify on camel-cxf-rest (42 tests passed)
  • mvn verify on camel-cxf-transport (12 tests passed)
  • mvn verify on camel-knative-http (162 tests passed)

Align CxfRsHeaderFilterStrategy, CxfHeaderFilterStrategy and
KnativeHttpHeaderFilterStrategy with HttpHeaderFilterStrategy by
adding setInFilterStartsWith(CAMEL_FILTER_STARTS_WITH) so that
internal headers are filtered in both directions.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 2, 2026

🌟 Thank you for your contribution to the Apache Camel project! 🌟
🤖 CI automation will test this PR automatically.

🐫 Apache Camel Committers, please review the following items:

  • First-time contributors require MANUAL approval for the GitHub Actions to run
  • You can use the command /component-test (camel-)component-name1 (camel-)component-name2.. to request a test from the test bot although they are normally detected and executed by CI.
  • You can label PRs using build-all, build-dependents, skip-tests and test-dependents to fine-tune the checks executed by this PR.
  • Build and test logs are available in the summary page. Only Apache Camel committers have access to the summary.

⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

Copy link
Copy Markdown
Contributor

@gnodet gnodet left a comment

Choose a reason for hiding this comment

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

Nice work on this PR, Federico! The change is clean, well-scoped, and addresses a legitimate gap in header filtering by aligning these three filter strategies with HttpHeaderFilterStrategy.

A few observations:

JIRA linkage

This appears related to CAMEL-23222 ("Filter inbound Camel headers") — a similar setInFilterStartsWith was added to MailHeaderFilterStrategy under that ticket. If this is part of the same effort, linking the JIRA would provide traceability. I can create a dedicated JIRA issue if needed.

Inbound/outbound asymmetry in KnativeHttpHeaderFilterStrategy

The outbound filter uses a regex (?i)(Camel|org\.apache\.camel)[…] which catches both Camel and org.apache.camel prefixes, while the new inbound filter uses CAMEL_FILTER_STARTS_WITH ({"Camel", "camel"}) which doesn't cover org.apache.camel-prefixed headers. This is consistent with how HttpHeaderFilterStrategy does it, so the alignment goal is met — just flagging it for awareness.

Tests

The PR description mentions existing module tests pass, which is good. However, there are no new tests that specifically verify that Camel-prefixed headers are filtered on the inbound path. A test asserting that a header like CamelFileName is stripped when coming from an external source would strengthen confidence and prevent regressions. I can help provide those tests if you'd like.

Overall, this looks good — the suggestions above are non-blocking.

Claude Code on behalf of Guillaume Nodet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants