-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
bugThis issue is a bug.This issue is a bug.needs-triageThis issue or PR still needs to be triaged.This issue or PR still needs to be triaged.
Description
Describe the bug
aws-sdk-cpp/src/aws-cpp-sdk-identity-management/source/auth/STSProfileCredentialsProvider.cpp
Line 48 in 1e5a155
| if (!IsTimeToRefresh(static_cast<long>(m_reloadFrequency.count())) || !m_credentials.IsExpiredOrEmpty()) |
The condition of credential refresh doesn't get refreshed 5 minutes before expiry, as specified in the constructor:
aws-sdk-cpp/src/aws-cpp-sdk-identity-management/source/auth/STSProfileCredentialsProvider.cpp
Line 33 in 1e5a155
| m_reloadFrequency(std::chrono::minutes(std::max(int64_t(5), static_cast<int64_t>(duration.count()))) - std::chrono::minutes(5)), |
as the refresh can only be made if
m_credentials.IsExpiredOrEmpty() == true.
As a result, the token could pass the expiry check here but rejected by the endpoint milisecond later.
Regression Issue
- Select this option if this issue appears to be a regression.
Expected Behavior
Reference: class STSCredentialsProvider :
| if (!m_credentials.IsEmpty() && !ExpiresSoon()) |
Have a grace period. Refresh token minutes before expiry
Current Behavior
Refresh only when the credential is found to be expired during checking
Reproduction Steps
- Enable logging
- Create a connection to aws endpoint with
STSProfileCredentialsProvider.cpp - Call some s3 api, e.g. ListObjectV2, per second
- By reading the log, it can be determined when does the refresh happen
Possible Solution
|| to && in the conditions
Additional Information/Context
No response
AWS CPP SDK version used
1.11.474
Compiler and Version used
gcc version 11.4.0
Operating System and version
Ubuntu 22.04
Metadata
Metadata
Assignees
Labels
bugThis issue is a bug.This issue is a bug.needs-triageThis issue or PR still needs to be triaged.This issue or PR still needs to be triaged.