Skip to content

Avoid cloning ImmutableCredentials objects. #3936

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 31, 2025

Conversation

teo-tsirpanis
Copy link
Contributor

Description

This PR removes all calls to the ImmutableCredentials.Copy method.

Motivation and Context

ImmutableCredentials objects are immutable, and thus there is no need to call the Copy() method, which seems to have been added due to an oversight almost 10 years ago.

Also, cloning immutable credentials will inhibit caching of the SigV4a signing key (#3923 (comment)).

Testing

Not tested locally

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project
  • My change requires a change to the documentation
  • I have updated the documentation accordingly
  • I have read the README document
  • I have added tests to cover my changes
  • All new and existing tests passed

License

  • I confirm that this pull request can be released under the Apache 2 license

Copy link
Contributor Author

@teo-tsirpanis teo-tsirpanis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To reviewers: what should we do with ImmutableCredentials.Copy()? We can do any of the following:

  • Obsolete it.
  • Hide it from IntelliSense.
  • Update its implementation to return this;.

@sankettangade sankettangade requested a review from normj July 30, 2025 17:29
Copy link
Contributor

@boblodgett boblodgett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes look valid. I will dry run this PR to see if there are any problems.

"updateMinimum": false,
"type": "patch",
"changeLogMessages": [
"Avoid cloning \u0060ImmutableCredentials\u0060 objects."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not positive if our build system will accept \u0060 but I will dry run this PR to determine.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DRY_RUN-c6382969-8690-4729-a359-43bb125eb338 started

Copy link
Contributor

@boblodgett boblodgett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DryRun passed.

@boblodgett boblodgett merged commit a18a106 into aws:development Jul 31, 2025
@teo-tsirpanis teo-tsirpanis deleted the rm-copy-immutable branch July 31, 2025 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants