Skip to content

Commit

Permalink
fix(cli): do not print credentials refreshed by plugins (#33398)
Browse files Browse the repository at this point in the history
### Issue #33394

Closes #33394

### Reason for this change

In #32354 we started logging credentials provided by a plugin to `stderr`. In #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*
  • Loading branch information
mrgrain authored Feb 11, 2025
1 parent 9449f9c commit a7d7373
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions packages/aws-cdk/lib/api/aws-auth/credential-plugins.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -151,7 +151,6 @@ function v3ProviderFromV2Credentials(x: SDKv2CompatibleCredentials): AwsCredenti

function refreshFromPluginProvider(current: AwsCredentialIdentity, producer: () => Promise<PluginProviderResult>): AwsCredentialIdentityProvider {
return async () => {
info(format(current), Date.now());
if (credentialsAboutToExpire(current)) {
const newCreds = await producer();
if (!isV3Credentials(newCreds)) {
Expand Down

0 comments on commit a7d7373

Please sign in to comment.