Claus Ibsen created CAMEL-27667:
-----------------------------------

             Summary: camel-aws - useSessionCredentials without keys falls back 
to the default credentials chain
                 Key: CAMEL-27667
                 URL: https://issues.apache.org/jira/browse/CAMEL-27667
             Project: Camel
          Issue Type: Bug
          Components: camel-aws2, camel-aws
            Reporter: Claus Ibsen
             Fix For: 4.24.0


{{AwsClientBuilderUtil.resolveCredentialsProvider}} in {{camel-aws-common}} 
(used by the client factories of almost all AWS components, e.g. aws2-ecs, 
aws-security-hub, aws2-s3, aws2-sqs) returns {{null}} when 
{{useSessionCredentials=true}} but the {{accessKey}}, {{secretKey}} or 
{{sessionToken}} is missing. The client builder then gets no credentials 
provider and the AWS SDK uses its default credentials chain (environment 
variables, system properties, {{~/.aws}} profiles, instance/container role) 
without any message.

So the client runs with whatever credentials the environment has, not the 
session credentials that were asked for. When only the {{sessionToken}} is 
missing, the access key and secret key are used as static credentials, without 
the token.

The component-level check in {{createEndpoint}} is skipped as soon as 
{{useSessionCredentials=true}}, so nothing catches this misconfiguration.

The same fall-through exists for static credentials: when only one of 
{{accessKey}} / {{secretKey}} is set (or one is an empty string), the default 
chain is used.

Proposed change: fail fast with an {{IllegalArgumentException}} that names the 
missing option(s) when {{useSessionCredentials=true}} and the access key, 
secret key or session token is missing, and when only one of 
accessKey/secretKey is set. Keep the documented behaviour when no credentials 
option is set at all (the SDK default chain), and keep 
{{useDefaultCredentialsProvider}} / {{useProfileCredentialsProvider}} as they 
are.

_Claude Code on behalf of Claus Ibsen_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to