This is an automated email from the ASF dual-hosted git repository.
oscerd pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new ce805f937d42 CAMEL-24468: camel-ibm-secrets-manager - fix multiple
defects in IBMSecretsManagerPropertiesFunction (env-var credentials, version
pinning, missing KV field) (#25640)
ce805f937d42 is described below
commit ce805f937d42f227c217a90b240f8ce03b5b1c27
Author: Andrea Cosentino <[email protected]>
AuthorDate: Tue Aug 25 10:51:16 2026 +0200
CAMEL-24468: camel-ibm-secrets-manager - fix multiple defects in
IBMSecretsManagerPropertiesFunction (env-var credentials, version pinning,
missing KV field) (#25640)
* CAMEL-24468: camel-ibm-secrets-manager - fix inverted credential check so
the environment-variable configuration works
IBMSecretsManagerPropertiesFunction.doStart() only built the SecretsManager
client when both CAMEL_VAULT_IBM_TOKEN and CAMEL_VAULT_IBM_SERVICE_URL were
empty, and threw otherwise. So setting those documented environment
variables
(the first configuration method in the class Javadoc, and the norm in
containers) made CamelContext startup fail with a message telling the user
to
set credentials they had already set.
Read the environment variables, fall back to the vault configuration only
when
both are empty, then build the client when a token and service URL are
available from either source, throwing only when neither provides them.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Signed-off-by: Andrea Cosentino <[email protected]>
* CAMEL-24468: camel-ibm-secrets-manager - keep the secret version and fix
the missing-field default in IBMSecretsManagerPropertiesFunction
getSecretFromSource() fetched the requested secret version's data and then
overwrote it with the current version's data, so version pinning
(ibm:group:secret#field@version) was silently ignored for KV secrets. It
also
returned the literal string "null" for a missing KV field, which is
non-empty
and therefore bypassed the default-value fallback. Keep the versioned data
and
null-guard the field lookup so the provided default value is used when the
field
is absent. The ARBITRARY/payload branch was already correct.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Signed-off-by: Andrea Cosentino <[email protected]>
---------
Signed-off-by: Andrea Cosentino <[email protected]>
Co-authored-by: Claude Opus 4.8 <[email protected]>
---
.../secrets/manager/IBMSecretsManagerPropertiesFunction.java | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git
a/components/camel-ibm/camel-ibm-secrets-manager/src/main/java/org/apache/camel/component/ibm/secrets/manager/IBMSecretsManagerPropertiesFunction.java
b/components/camel-ibm/camel-ibm-secrets-manager/src/main/java/org/apache/camel/component/ibm/secrets/manager/IBMSecretsManagerPropertiesFunction.java
index 0c6dbce177cc..b63deca23517 100644
---
a/components/camel-ibm/camel-ibm-secrets-manager/src/main/java/org/apache/camel/component/ibm/secrets/manager/IBMSecretsManagerPropertiesFunction.java
+++
b/components/camel-ibm/camel-ibm-secrets-manager/src/main/java/org/apache/camel/component/ibm/secrets/manager/IBMSecretsManagerPropertiesFunction.java
@@ -100,6 +100,8 @@ public class IBMSecretsManagerPropertiesFunction extends
ServiceSupport implemen
token = ibmVaultConfiguration.getToken();
serviceUrl = ibmVaultConfiguration.getServiceUrl();
}
+ }
+ if (ObjectHelper.isNotEmpty(token) &&
ObjectHelper.isNotEmpty(serviceUrl)) {
IamAuthenticator iamAuthenticator = new IamAuthenticator.Builder()
.apikey(token)
.build();
@@ -212,14 +214,8 @@ public class IBMSecretsManagerPropertiesFunction extends
ServiceSupport implemen
Response<SecretVersion> secVersion =
client.getSecretVersion(getSecretVersionOptions).execute();
data = secVersion.getResult().getData();
}
- if (ObjectHelper.isNotEmpty(data)) {
- data = response.getResult().getData();
- }
- if (ObjectHelper.isNotEmpty(subkey)) {
- returnValue = String.valueOf(data.get(subkey));
- } else {
- returnValue = null;
- }
+ Object subValue = data.get(subkey);
+ returnValue = subValue != null ? String.valueOf(subValue) :
null;
if (ObjectHelper.isEmpty(returnValue)) {
returnValue = defaultValue;
}