Andrea Cosentino created CAMEL-24470:
----------------------------------------

             Summary: camel-ibm-secrets-manager: 
IBMEventStreamReloadTriggerTask rejects Event Stream credentials provided via 
environment variables
                 Key: CAMEL-24470
                 URL: https://issues.apache.org/jira/browse/CAMEL-24470
             Project: Camel
          Issue Type: Bug
            Reporter: Andrea Cosentino
            Assignee: Andrea Cosentino
             Fix For: 4.23.0


The IBMEventStreamReloadTriggerTask.doStart() credential-resolution logic is 
inverted. After reading the CAMEL_VAULT_IBM_EVENTSTREAM_* environment variables 
(bootstrap servers, consumer group id, topic, username, password) it does:

{code:java}
if (isEmpty(bootstrapServers) && isEmpty(groupId) && isEmpty(topic) && 
isEmpty(password)) {
    // read the values from IBMSecretsManagerVaultConfiguration
    ...
} else {
    throw new RuntimeCamelException(
        "Using the IBM Secrets Refresh Task requires setting IBM Event Stream 
bootstrap servers, topic, groupId, username and password as application 
properties or environment variables");
}
{code}

So when the documented environment variables ARE set (non-empty), the else 
branch is taken and startup fails with the exact message that claims those 
variables are required. In practice the Kafka-based secret-refresh trigger can 
only be configured through the vault configuration object; the 
environment-variable path documented for the task always throws.

Fix: resolve the credentials from the environment variables when present, 
otherwise fall back to the vault configuration, and only throw when the 
required values are still missing after both sources have been consulted 
(mirroring the fix applied to IBMSecretsManagerPropertiesFunction in 
CAMEL-24468). The username should keep defaulting to "token" (IBM Event Streams 
SASL user) when not supplied.

Affected: components/camel-ibm/camel-ibm-secrets-manager 
(org.apache.camel.component.ibm.secrets.manager.vault.IBMEventStreamReloadTriggerTask).



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to