RefreshingAWSCredentials ShouldUpdateState() call to IsExpiredWithin() uses TimeSpan.Zero instead of PreemptExpiryTime #3613
Labels
bug
This issue is a bug.
credentials
needs-review
p2
This is a standard priority issue
s
Effort estimation: small
Describe the bug
Found in commit 17334e8
RefreshingAWSCredentials calls ShouldUpdateState() on multiple paths (GetCredentials(), GetCredentialsAsync(), and UpdateToGeneratedCredentials() methods; ShouldUpdate property) with the PreemptyExpiryTime property.
However, the ShouldUpdateState() method ignores the value of the preemptExpiryTime parameter and uses TimeSpan.Zero instead. This means we will not try to update the credentials until they have already expired. (In the case of AssumeRoleAWSCredentials, the PreemptExpiryTime is 15 minutes; so 15 minutes before the expiration time.)
aws-sdk-net/sdk/src/Core/Amazon.Runtime/Credentials/RefreshingAWSCredentials.cs
Line 240 in 17334e8
Regression Issue
Expected Behavior
ShouldUpdateState() uses its preemptExpiryTIme parameter, so credentials are updated before they are expired.
Current Behavior
ShouldUpdateState() effectively ignored the preemptyExpiryTime, so credentials are not updated until already expired.
Reproduction Steps
Read the description.
Possible Solution
Change the below line to use the preemptExpiryTime parameter instead of TimeSpan.Zero.
Additional Information/Context
No response
AWS .NET SDK and/or Package version used
AWSSDK.Core 3.7.401.2
Targeted .NET Platform
not relevant - but .NET 9
Operating System and version
not relevant - but macOS Sequoia 15.2
The text was updated successfully, but these errors were encountered: