[ 
https://issues.apache.org/jira/browse/CAMEL-24468?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andrea Cosentino resolved CAMEL-24468.
--------------------------------------
    Resolution: Fixed

> 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.22.1, 4.23.0, 4.18.5
>
>
> 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)

Reply via email to