Skip to content

Custom user-agent not propagated to nested STS client #7439

@jackrein

Description

@jackrein

Checkboxes for prior research

Describe the bug

When using role chaining, the custom user agent on the outer client is not propagated to the nested STS client.

Regression Issue

  • Select this option if this issue appears to be a regression.

SDK version number

3.911.0

Which JavaScript Runtime is this issue in?

Node.js

Details of the browser/Node.js/ReactNative version

v18.20.2

Reproduction Steps

  1. Create the following content in ~/.aws/config file:
    [profile second]
    credential_process=/usr/bin/get-credentials
    region=us-west-2
    
    [profile first]
    source_profile=second
    role_arn=arn:aws:iam::123456789012:role/Role
    
  2. Use the SDK with the first role: AWS_PROFILE=first npm run start (start invokes the following script)
    import { S3Client, ListBucketsCommand } from '@aws-sdk/client-s3';
    
    const s3Client = new S3Client({
        defaultUserAgentProvider: () => Promise.resolve(["my-user-agent", "1"]), // or customUserAgent
        logger: {
            ...console
        }
    });
    const command = new ListBucketsCommand({});
    const response = await s3Client.send(command);
    

Observed Behavior

Observe two AWS requests in CloudTrail. The AssumeRole request retains the default user-agent. The ListBuckets request contains the custom user agent:

  1. aws-sdk-js/3.911.0 ua/2.1 os/darwin#24.6.0 lang/js md/nodejs#18.20.2 api/sts#3.911.0 m/E,w,v vs
  2. my-user-agent m/E,T,i,o

Expected Behavior

Both requests contain the my-user-agent m/E,T,i,o user agent value.

Possible Solution

Propagate the custom user agent values to the nested STS client.

Note: other configuration to the outer client, like custom middleware, is not propagated to the nested client as well

Additional Information/Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.needs-triageThis issue or PR still needs to be triaged.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions