Croway opened a new pull request, #1961:
URL: https://github.com/apache/camel-spring-boot/pull/1961

   Cherry-pick of #1913 onto `camel-spring-boot-4.22.x`.
   
   **Original PR:** #1913 — camel-spring-boot - see camel properties supplied 
as environment variables
   **JIRA:** [CAMEL-24503](https://issues.apache.org/jira/browse/CAMEL-24503)
   
   ### What it fixes
   
   `CamelSecurityPolicyAutoConfiguration.extractCamelProperties` collected 
candidate properties by
   matching each Spring `Environment` property name literally against the 
`camel.` prefix. That works
   fine for properties coming from `application.properties`/YAML, but the 
`systemEnvironment` property
   source reports names in their native form (e.g. `CAMEL_COMPONENT_FOO_BAR`), 
which never starts with
   `camel.` — even though Spring Boot's relaxed binding still applies that 
value to the Camel component
   regardless of how it is expressed.
   
   The practical effect was a security-policy bypass: the `camel.security` 
policy check introduced in
   CAMEL-23250 was blind to any Camel option supplied via environment 
variables, which is the standard
   way to configure a containerised deployment (Docker/Kubernetes env vars, 
`.env` files, etc.). A
   policy-violating option set that way would silently take effect on the 
component while going
   completely unnoticed by the check.
   
   The fix canonicalizes each reported property name with 
`ConfigurationPropertyName.adapt(name, '_')`
   before testing the `camel.` prefix, and performs the environment lookup 
using that canonical name so
   relaxed binding resolves it back to the actual value. 
`SecurityUtils.getSecurityOption` already
   lowercases and strips dashes, so the canonicalized name still matches the 
same security option
   correctly.
   
   ### Branch applicability
   
   Confirmed camel-spring-boot-4.18.x does not carry CAMEL-23250's 
security-policy feature, so this fix does not
   apply there — 4.22.x only.
   
   ### Verification on this branch
   
   - Cherry-pick (`git cherry-pick -x`) applied cleanly with no conflicts; the 
diff touches only
     `CamelSecurityPolicyAutoConfiguration.java` and 
`CamelSecurityPolicyAutoConfigurationTest.java` in
     `core/camel-spring-boot`.
   - Ran `CamelSecurityPolicyAutoConfigurationTest` directly: 12/12 tests 
passed.
   - Ran the full `core/camel-spring-boot` module verify (`mvn verify`): 140 
tests run, 0 failures, 0
     errors, 1 skipped (pre-existing, unrelated to this change), plus 2 passing 
integration tests
     (`CamelVirtualThreadsIT`). Overall `BUILD SUCCESS`.
   - (Local-build-only workaround: temporarily repointed the unresolvable 
SNAPSHOT parent/camel-version
     to the released `4.22.0` to allow a from-scratch build; those edits were 
reverted before pushing —
     this PR contains only the cherry-picked commit.)
   
   _Claude Code on behalf of Federico Mariani_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to