Skip to content

CAMEL-24503: camel-spring-boot - see camel properties supplied as environment variables - #1913

Merged
Croway merged 1 commit into
apache:mainfrom
oscerd:fix/CAMEL-24503
Aug 28, 2026
Merged

CAMEL-24503: camel-spring-boot - see camel properties supplied as environment variables#1913
Croway merged 1 commit into
apache:mainfrom
oscerd:fix/CAMEL-24503

Conversation

@oscerd

@oscerd oscerd commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

CamelSecurityPolicyAutoConfiguration.extractCamelProperties() collects the properties the camel.security
policy framework (CAMEL-23250) evaluates, filtering on the name exactly as the source reports it:

if (name != null && name.startsWith("camel.") && !name.startsWith("camel.security.")) {

Property sources report names in their own form. An option set in application.properties arrives as
camel.component.http.trustAllCertificates; the same option set as an environment variable arrives as
CAMEL_COMPONENT_HTTP_TRUSTALLCERTIFICATES, which never matches the camel. prefix — even though Spring's
relaxed 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 prefix
test, 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.getSecurityOption already takes the last segment, lowercases it
and strips dashes — so the canonical camel.component.http.trustallcertificates resolves to the same
trustallcertificates option 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 real SystemEnvironmentPropertySource so
the name arrives in native form rather than being pre-normalised by the test:

  • policyShouldSeeInsecureOptionsSetThroughTheEnvironmentCAMEL_COMPONENT_HTTP_TRUSTALLCERTIFICATES=true
    now raises a violation, and the reported propertyKey is the canonical name
  • environmentVariablesUnrelatedToCamelAreIgnored — a non-Camel variable whose last segment happens to be a
    security option name (SOME_OTHER_TRUSTALLCERTIFICATES) must not raise one

Verified meaningful: the first fails against main (no violation detected), the second passes either way as a
negative control. Full core/camel-spring-boot suite: 140 tests, 0 failures. Root reactor build green.

…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>
@oscerd
oscerd requested review from Croway, davsclaus and gnodet August 28, 2026 07:54
@Croway
Croway merged commit 27fb340 into apache:main Aug 28, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants