CAMEL-24503: camel-spring-boot - see camel properties supplied as environment variables - #1913
Merged
Merged
Conversation
…ironment variables extractCamelProperties filtered on the property name exactly as its source reports it. The systemEnvironment source reports environment variables in their native CAMEL_COMPONENT_FOO_BAR form, which never matches the "camel." prefix, so any Camel option configured through the environment was invisible to the camel.security policy check added in CAMEL-23250 - even though Spring's relaxed binding applies it to the component regardless. That is the usual way to configure a containerised application, so the check was blind to a large part of real deployments. Names are now canonicalized with ConfigurationPropertyName.adapt before the prefix test, and the canonical name is used for the lookup so relaxed binding resolves it back to the variable. SecurityUtils.getSecurityOption already lowercases and strips dashes, so the canonical name matches the same option. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: Andrea Cosentino <ancosen@gmail.com>
davsclaus
approved these changes
Aug 28, 2026
Croway
approved these changes
Aug 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CamelSecurityPolicyAutoConfiguration.extractCamelProperties()collects the properties thecamel.securitypolicy framework (CAMEL-23250) evaluates, filtering on the name exactly as the source reports it:
Property sources report names in their own form. An option set in
application.propertiesarrives ascamel.component.http.trustAllCertificates; the same option set as an environment variable arrives asCAMEL_COMPONENT_HTTP_TRUSTALLCERTIFICATES, which never matches thecamel.prefix — even though Spring'srelaxed binding applies it to the component just the same.
So every Camel option configured through the environment escaped the policy check. That is the usual way to
configure a containerised application, so the check was blind to a large part of real deployments.
Change
Names are canonicalized with Spring Boot's own
ConfigurationPropertyName.adapt(name, '_')before the prefixtest, and the canonical name is used for the value lookup so relaxed binding resolves it back to the variable.
This works end to end because
SecurityUtils.getSecurityOptionalready takes the last segment, lowercases itand strips dashes — so the canonical
camel.component.http.trustallcertificatesresolves to the sametrustallcertificatesoption as the camelCase form. No change was needed on the camel-core side.camel.security.*stays excluded, in both forms.Tests
Two added to
CamelSecurityPolicyAutoConfigurationTest, injecting a realSystemEnvironmentPropertySourcesothe name arrives in native form rather than being pre-normalised by the test:
policyShouldSeeInsecureOptionsSetThroughTheEnvironment—CAMEL_COMPONENT_HTTP_TRUSTALLCERTIFICATES=truenow raises a violation, and the reported
propertyKeyis the canonical nameenvironmentVariablesUnrelatedToCamelAreIgnored— a non-Camel variable whose last segment happens to be asecurity option name (
SOME_OTHER_TRUSTALLCERTIFICATES) must not raise oneVerified meaningful: the first fails against
main(no violation detected), the second passes either way as anegative control. Full
core/camel-spring-bootsuite: 140 tests, 0 failures. Root reactor build green.