[
https://issues.apache.org/jira/browse/CAMEL-24468?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18107793#comment-18107793
]
Andrea Cosentino commented on CAMEL-24468:
------------------------------------------
Merged to main via PR https://github.com/apache/camel/pull/25640 (commit
ce805f937d42), targeting 4.23.0. Backports to camel-4.22.x and camel-4.18.x
will follow (module and bug present on both); leaving this In Progress until
they land.
_Claude Code on behalf of oscerd_
> camel-ibm-secrets-manager - fix defects in
> IBMSecretsManagerPropertiesFunction (env-var credentials rejected, secret
> version pin ignored, missing KV field returns "null")
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-24468
> URL: https://issues.apache.org/jira/browse/CAMEL-24468
> Project: Camel
> Issue Type: Bug
> Reporter: Andrea Cosentino
> Assignee: Andrea Cosentino
> Priority: Major
> Fix For: 4.23.0
>
>
> h3. Problem
> {{IBMSecretsManagerPropertiesFunction.doStart()}} inverts its credential
> check:
> {code:java}
> String token = System.getenv(CAMEL_VAULT_IBM_TOKEN_ENV);
> String serviceUrl = System.getenv(CAMEL_VAULT_IBM_SERVICE_URL_ENV);
> if (ObjectHelper.isEmpty(token) && ObjectHelper.isEmpty(serviceUrl)) {
> // fall back to vault config, then build the client
> } else {
> throw new RuntimeCamelException(
> "Using the IBM Secrets Manager Properties Function requires setting
> IBM Credentials and service url ...");
> }
> {code}
> The client is only built when *both* env vars are empty. So when a user sets
> the documented {{CAMEL_VAULT_IBM_TOKEN}} / {{CAMEL_VAULT_IBM_SERVICE_URL}}
> environment variables (the first configuration method described in the class
> Javadoc, and the norm in containers/Kubernetes), the condition is false,
> control goes to the else, and CamelContext startup fails with a message
> telling the user to set credentials they already set. The
> environment-variable configuration path is therefore unusable; only
> application.properties/vault-config works.
> h3. Fix
> Use the same shape as the AWS/Google secrets-manager properties functions:
> read the env vars; if both are empty fall back to the vault configuration;
> then build the client when a token and service url are available (from either
> source) and only throw when neither provides them.
> Affects main (4.23.0-SNAPSHOT).
--
This message was sent by Atlassian Jira
(v8.20.10#820010)