From a7d73732cc41db518bd92eac3fd2e0f159ab3b7a Mon Sep 17 00:00:00 2001 From: Momo Kornher Date: Tue, 11 Feb 2025 19:54:24 +0000 Subject: [PATCH] fix(cli): do not print credentials refreshed by plugins (#33398) ### Issue #33394 Closes #33394 ### Reason for this change In https://github.com/aws/aws-cdk/pull/32354 we started logging credentials provided by a plugin to `stderr`. In https://github.com/aws/aws-cdk/pull/32708 we changed the log statement in a way that the credentials would be logged to `stdout` in CI environments (but still to `stderr` in all other environments). ### Description of changes Do not log credentials. ### Describe any new or updated permissions being added n/a ### Description of how you validated changes n/a ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- packages/aws-cdk/lib/api/aws-auth/credential-plugins.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/aws-cdk/lib/api/aws-auth/credential-plugins.ts b/packages/aws-cdk/lib/api/aws-auth/credential-plugins.ts index 84303ffb4c5ca..6f70ab67b96f5 100644 --- a/packages/aws-cdk/lib/api/aws-auth/credential-plugins.ts +++ b/packages/aws-cdk/lib/api/aws-auth/credential-plugins.ts @@ -1,8 +1,8 @@ -import { inspect, format } from 'util'; +import { inspect } from 'util'; import type { CredentialProviderSource, ForReading, ForWriting, PluginProviderResult, SDKv2CompatibleCredentials, SDKv3CompatibleCredentialProvider, SDKv3CompatibleCredentials } from '@aws-cdk/cli-plugin-contract'; import type { AwsCredentialIdentity, AwsCredentialIdentityProvider } from '@smithy/types'; import { credentialsAboutToExpire, makeCachingProvider } from './provider-caching'; -import { debug, warning, info } from '../../logging'; +import { debug, warning } from '../../logging'; import { AuthenticationError } from '../../toolkit/error'; import { formatErrorMessage } from '../../util/error'; import { Mode } from '../plugin/mode'; @@ -151,7 +151,6 @@ function v3ProviderFromV2Credentials(x: SDKv2CompatibleCredentials): AwsCredenti function refreshFromPluginProvider(current: AwsCredentialIdentity, producer: () => Promise): AwsCredentialIdentityProvider { return async () => { - info(format(current), Date.now()); if (credentialsAboutToExpire(current)) { const newCreds = await producer(); if (!isV3Credentials(newCreds)) {