Skip to content

Fix race when publishing refreshed credentials - #3835

Merged
alexgromero merged 2 commits into
developfrom
fix/credential-refresh-race
Oct 19, 2026
Merged

alexgromero merged 2 commits into
developfrom
fix/credential-refresh-race

Conversation

@alexgromero

@alexgromero alexgromero commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Issue #, if available:
Fixes #3827

Overview

Fixes a race where a concurrent call to get_frozen_credentials() could return expired credentials while another thread was refreshing them.

The refreshed expiry time could become visible before the refreshed frozen credentials were published. A concurrent caller could then see the new expiry time and return the old credentials.

Approach

This change stages the refreshed expiry time until the credentials are ready to be published. The frozen credentials are published first, followed by the new expiry time.

Publication remains in _protected_refresh() instead of moving into _set_from_data(). This preserves existing behavior for custom credential providers that override _set_from_data() as part of their refresh implementation.

Testing

Added a concurrency test verifying that callers receive the refreshed frozen credentials during a refresh. Existing credential tests continue to pass.


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@alexgromero
alexgromero requested a review from a team as a code owner October 19, 2026 00:55
@alexgromero
alexgromero merged commit 34d8a32 into develop Oct 19, 2026
114 of 115 checks passed
@alexgromero
alexgromero deleted the fix/credential-refresh-race branch October 19, 2026 14:52
Alan4506 pushed a commit that referenced this pull request Oct 19, 2026
* release-1.43.115:
  Bumping version to 1.43.115
  Update to latest models
  Fix race when publishing refreshed credentials (#3835)
  Bump urllib3 from 2.7.0 to 2.8.0 (#3813)
  Move Content-Length validation back to botocore (#3831)
  Add W3C headers to unsigned hop-by-hop header list (#3805)
  Bump https://github.com/astral-sh/ruff-pre-commit (#3829)
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.

RefreshableCredentials: concurrent get_frozen_credentials() can return expired credentials during a refresh

2 participants