aws / aws-sdk-js-v3

Modularized AWS SDK for JavaScript.
Apache License 2.0
3.13k stars 580 forks source link

SSO requests ignore proxy configuration #6687

Open otaviomacedo opened 1 week ago

otaviomacedo commented 1 week ago

Checkboxes for prior research

Describe the bug

The SDK gets credentials via SSO directly (ignoring proxy configuration) provided in the fromIni() method.

Regression Issue

SDK version number

@aws-sdk/credential-providers@3.696.0

Which JavaScript Runtime is this issue in?

Node.js

Details of the browser/Node.js/ReactNative version

node version: v22.9.0

Reproduction Steps

  1. Precondition: the SSO set-up has been done (creating user, aws sso login etc).
  2. Start a proxy on port 8080. I'm using mitmproxy.
  3. Install the CA certificate.
  4. Run the following code:
    const agent = new ProxyAgent({
      ca: fs.readFileSync('/path/to/pem', { encoding: 'utf-8' }),
      getProxyForUrl: () => Promise.resolve('http://localhost:8080'),
    });

    const provider = fromIni({
      profile: 'test',
      ignoreCache: true,
      clientConfig: {
        requestHandler: {
          connectionTimeout: 30000,
          requestTimeout: 10000,
          httpsAgent: agent,
          httpAgent: agent,
        },
      },
    });

    console.log(await provider());
  1. Watch the proxy logs.

Observed Behavior

The TypeScript program will print the AWS credentials, but the proxy won't show any activity. To further confirm, if I shut down the proxy, the credentials are still retrieved.

Expected Behavior

Proxy show activity when up and request fail when proxy is down.

Possible Solution

No response

Additional Information/Context

Related issue: https://github.com/aws/aws-cdk/issues/32208

kuhe commented 3 days ago

a fix for this was released in https://github.com/aws/aws-sdk-js-v3/releases/tag/v3.699.0