Add inbound header filtering to CXF and Knative filter strategies#22413
Add inbound header filtering to CXF and Knative filter strategies#22413Croway wants to merge 1 commit intoapache:mainfrom
Conversation
Align CxfRsHeaderFilterStrategy, CxfHeaderFilterStrategy and KnativeHttpHeaderFilterStrategy with HttpHeaderFilterStrategy by adding setInFilterStartsWith(CAMEL_FILTER_STARTS_WITH) so that internal headers are filtered in both directions.
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
gnodet
left a comment
There was a problem hiding this comment.
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
Summary
CxfRsHeaderFilterStrategy,CxfHeaderFilterStrategyandKnativeHttpHeaderFilterStrategywithHttpHeaderFilterStrategyby addingsetInFilterStartsWith(CAMEL_FILTER_STARTS_WITH)so that internal headers are filtered in both directions.Test plan
mvn verifyoncamel-cxf-rest(42 tests passed)mvn verifyoncamel-cxf-transport(12 tests passed)mvn verifyoncamel-knative-http(162 tests passed)