[
https://issues.apache.org/jira/browse/CAMEL-27161?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Work on CAMEL-27161 started by Andrea Cosentino.
------------------------------------------------
> camel-main - the security policy does not check the properties of beans
> defined in YAML or XML route files
> ----------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-27161
> URL: https://issues.apache.org/jira/browse/CAMEL-27161
> Project: Camel
> Issue Type: Improvement
> Components: camel-main, camel-yaml-dsl
> Reporter: Andrea Cosentino
> Assignee: Andrea Cosentino
> Priority: Major
>
> The security policy ({{camel.security.*}}, which fails startup with
> {{camel.main.profile=prod}}) checks the {{camel.*}} configuration properties
> only. The beans that a YAML or XML route file defines in its {{beans}}
> section are not checked, so the same insecure option fails startup when it is
> set in {{application.properties}} and is accepted when it is set on the bean
> in the route file.
> With {{camel.main.profile=prod}} and camel-opa on Camel 4.23.0:
> * {{camel.beans.opaPolicy.failOpen=true}} in {{application.properties}} fails
> startup with {{[insecure:dev] Insecure configuration detected (category:
> insecure:dev) [camel.beans.opaPolicy.failOpen]}}
> * the same option on a YAML bean starts, and the bean has {{failOpen=true}}:
> {code:yaml}
> - beans:
> - name: opaPolicy
> type: org.apache.camel.component.opa.security.OpaSecurityPolicy
> properties:
> policyPath: authz/allow
> failOpen: true
> {code}
> The same holds for the other categories, such as a plain-text {{password}} on
> a bean.
> {{BaseMainSupport.enforceSecurityPolicies}} gets the auto-configured
> {{camel.*}} properties only. The YAML and XML DSL create their beans from a
> {{BeanFactoryDefinition}} and register it with {{Model.addCustomBean}}, and
> its properties never reach {{SecurityUtils.detectViolations}}.
> Suggested change: once the routes are loaded, check the properties of the
> beans in {{Model.getCustomBeans()}} with {{SecurityUtils.detectViolations}},
> keyed {{camel.beans.<name>.<property>}} like a bean configured from
> properties, so the option matching and {{camel.security.allowedProperties}}
> work the same way, and add the violations to {{SecurityPolicyResult}} for the
> health check. Needs an upgrade-guide entry: a prod-profile application with
> an insecure option or a plain-text secret on such a bean would then fail at
> startup, and the other profiles may log new warnings.
> Not covered here: options set in the endpoint URIs of routes (such as
> {{opa:authz/allow?failOpen=true}}) are not checked either. Route-level URI
> scanning is listed as future work in {{design/security.adoc}}.
> _Claude Code on behalf of oscerd_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)