Andrea Cosentino created CAMEL-24900:
----------------------------------------

             Summary: camel-jcr - apply header filtering when mapping JCR node 
properties to Exchange headers
                 Key: CAMEL-24900
                 URL: https://issues.apache.org/jira/browse/CAMEL-24900
             Project: Camel
          Issue Type: Task
          Components: camel-jcr
            Reporter: Andrea Cosentino


The JCR producer's CamelJcrGetById operation maps every property of the 
retrieved node onto the Exchange via message.setHeader(property.getName(), ...) 
without running the names through a HeaderFilterStrategy. Unlike most 
components, camel-jcr defines no HeaderFilterStrategy, so internal Camel header 
names (e.g. those prefixed "Camel") are not filtered out of the mapped set. The 
INSERT path has the mirror gap: filterComponentHeaders removes only the three 
JCR control keys (CamelJcrNodeName/CamelJcrOperation/CamelJcrNodeType), so 
internal Camel headers on the message are persisted as node properties.

This continues the header-filtering alignment done for camel-coap (CAMEL-24655).

Proposed change:
- Make JcrEndpoint HeaderFilterStrategyAware with a default strategy that 
filters Camel*/camel*/org.apache.camel.* case-insensitively.
- In the CamelJcrGetById mapping, filter each property name through 
applyFilterToExternalHeaders before setHeader, preserving ordinary document 
properties.
- Apply the mirror filter (applyFilterToCamelHeaders) on the INSERT path.
- Add a regression test mirroring CoAPHeaderInjectionTest: a "Camel"-prefixed 
property name, in several casings, is not mapped onto the Exchange, while an 
ordinary property still is.
- Regenerate catalog/dsl (new headerFilterStrategy option), backport to 
camel-4.22.x and camel-4.18.x, and add the upgrade-guide note on main.

Affected: main (4.23.0), camel-4.22.x, camel-4.18.x. Not camel-4.14.x (EOL).



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to