Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changelog/bugfix-profile-provider-changelog.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"type": "bugfix",
"category": "aws-cpp-sdk-core",
"contributor": "sbiscigl",
"description": "Add ProfileCredentialsProvider constructors without refreshRateMs, log a warning when refreshRateMs is passed or Reload is called since neither does anything, document the 1.11.760 ProfileCredentialsProvider runtime change in the CHANGELOG, and remove a stray deprecation comment from ProfileConfigFileAWSCredentialsProvider."
}
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -1116,6 +1116,11 @@
* **SecurityAgent**: Adding private and self-signed certificate configuration support for penetration tests
* **Timestream InfluxDB**: Service-managed parameter groups now only apply optimized defaults to DB Clusters automatically. New field effectiveDbParameterGroupIdentifier surfaces the parameter group actually applied.

# 1.11.760 (2026-02-27)

## SDK Highlights
* **Breaking Change**: `ProfileCredentialsProvider`, used by the default credentials provider chain, is now backed by the CRT and no longer re-reads the shared credentials file on a timer. This is a runtime behavior change: credentials from the file have no expiration, so they are loaded once, matching other AWS SDKs, and `refreshRateMs` is still accepted but ignored. Use `credential_process` or web identity for credentials that rotate, or use `ProfileConfigFileAWSCredentialsProvider` to keep re-reading the file on an interval.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you.


# Announcement
We are moving the changelog to a new format and tying it to a new release process.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ namespace Aws
* Optionally a user can specify the profile and it will override the environment variable
* and defaults. To alter the file this pulls from, then the user should alter the AWS_SHARED_CREDENTIALS_FILE variable.
*/
// class AWS_DEPRECATED("This class is in the maintenance mode, no new updates will be released, use S3EncryptionClientV3. Please see https://docs.aws.amazon.com/general/latest/gr/aws_sdk_cryptography.html for more information.") AWS_CORE_API ProfileConfigFileAWSCredentialsProvider : public AWSCredentialsProvider
class AWS_CORE_API ProfileConfigFileAWSCredentialsProvider : public AWSCredentialsProvider
{
public:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,37 @@ namespace Auth {
class AWS_CORE_API ProfileCredentialsProvider : public AWSCredentialsProvider {
public:
/**
* Initializes with refreshRateMs as the frequency at which the file is reparsed in milliseconds. Defaults to 5 minutes.
* Initializes with the default profile. Credentials are refreshed when they expire,
* and credentials without an expiration are loaded once.
*/
ProfileCredentialsProvider(long refreshRateMs = REFRESH_THRESHOLD);
ProfileCredentialsProvider();

/**
* Initializes with a profile override and
* refreshRateMs as the frequency at which the file is reparsed in milliseconds. Defaults to 5 minutes.
* Initializes with the default profile. refreshRateMs is ignored, only kept so existing code compiles, and logs a warning.
*/
ProfileCredentialsProvider(const char* profile, long refreshRateMs = REFRESH_THRESHOLD);
ProfileCredentialsProvider(long refreshRateMs);

/**
* Initializes with a profile override. Credentials are refreshed when they expire,
* and credentials without an expiration are loaded once.
*/
ProfileCredentialsProvider(const char* profile);

/**
* Initializes with a profile override. refreshRateMs is ignored, only kept so existing code compiles, and logs a warning.
*/
ProfileCredentialsProvider(const char* profile, long refreshRateMs);

/**
* Initializes from a CredentialProviderConfiguration so settings such as allowSystemProxy can flow through.
*/
ProfileCredentialsProvider(const Aws::Client::ClientConfiguration::CredentialProviderConfiguration& config,
long refreshRateMs = REFRESH_THRESHOLD);
ProfileCredentialsProvider(const Aws::Client::ClientConfiguration::CredentialProviderConfiguration& config);

/**
* Initializes from a CredentialProviderConfiguration. refreshRateMs is ignored, only kept so existing code compiles,
* and logs a warning.
*/
ProfileCredentialsProvider(const Aws::Client::ClientConfiguration::CredentialProviderConfiguration& config, long refreshRateMs);

/**
* Retrieves the credentials if found, otherwise returns empty credential set.
Expand Down
35 changes: 24 additions & 11 deletions src/aws-cpp-sdk-core/source/auth/ProfileCredentialsProvider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <aws/core/client/UserAgent.h>
#include <aws/core/platform/Environment.h>
#include <aws/core/platform/FileSystem.h>
#include <aws/core/utils/logging/LogMacros.h>
#include <aws/crt/auth/Credentials.h>
#include <aws/crt/http/HttpConnection.h>

Expand All @@ -22,7 +23,8 @@ namespace {
const char PROFILE_AWS_CREDENTIALS_FILE[] = "AWS_SHARED_CREDENTIALS_FILE";
const char PROFILE_DEFAULT_CREDENTIALS_FILE[] = "credentials";
const char PROFILE_PROFILE_DIRECTORY[] = ".aws";
const long DEFAULT_REFRESH_RATE_MS = 300000;
const char PROFILE_PROVIDER_LOG_TAG[] = "ProfileCredentialsProvider";
const long PROVIDER_FUTURES_TIMEOUT_MS = 300000;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

5 minutes seems overdimensioned for retrieving profile credentials.
Use 60 seconds? That would even cover network-bound calls, if any.


std::shared_ptr<Aws::Crt::Auth::ICredentialsProvider> GetProfileCrtProvider(
const Aws::Client::ClientConfiguration::CredentialProviderConfiguration& credentialsConfig) {
Expand Down Expand Up @@ -56,15 +58,12 @@ class ProfileCredentialsProvider::ProfileCredentialsProviderImp : public CrtCred
CredentialsProviderProfileConfig config;
return CredentialsProvider::CreateCredentialsProviderProfile(config);
},
std::chrono::milliseconds(DEFAULT_REFRESH_RATE_MS), UserAgentFeature::CREDENTIALS_PROFILE, "ProfileCredentialsProvider") {}
std::chrono::milliseconds(PROVIDER_FUTURES_TIMEOUT_MS), UserAgentFeature::CREDENTIALS_PROFILE, "ProfileCredentialsProvider") {}

ProfileCredentialsProviderImp(const Aws::Client::ClientConfiguration::CredentialProviderConfiguration& credentialsConfig)
: CrtCredentialsProvider(
[credentialsConfig]() -> std::shared_ptr<ICredentialsProvider> {
return GetProfileCrtProvider(credentialsConfig);
},
std::chrono::milliseconds(DEFAULT_REFRESH_RATE_MS), UserAgentFeature::CREDENTIALS_PROFILE,
"ProfileCredentialsProvider") {}
[credentialsConfig]() -> std::shared_ptr<ICredentialsProvider> { return GetProfileCrtProvider(credentialsConfig); },
std::chrono::milliseconds(PROVIDER_FUTURES_TIMEOUT_MS), UserAgentFeature::CREDENTIALS_PROFILE, "ProfileCredentialsProvider") {}

static Aws::String GetCredentialsProfileFilename() {
auto credentialsFileNameFromVar = Aws::Environment::GetEnv(PROFILE_AWS_CREDENTIALS_FILE);
Expand All @@ -86,24 +85,38 @@ class ProfileCredentialsProvider::ProfileCredentialsProviderImp : public CrtCred
}
};

ProfileCredentialsProvider::ProfileCredentialsProvider(long refreshRateMs) : m_impl(std::make_shared<ProfileCredentialsProviderImp>()) {
ProfileCredentialsProvider::ProfileCredentialsProvider() : m_impl(std::make_shared<ProfileCredentialsProviderImp>()) {}

ProfileCredentialsProvider::ProfileCredentialsProvider(long refreshRateMs) : ProfileCredentialsProvider() {
AWS_UNREFERENCED_PARAM(refreshRateMs);
AWS_LOGSTREAM_WARN(PROFILE_PROVIDER_LOG_TAG, "refreshRateMs is ignored, credentials refresh when they expire");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The message is misleading, as the profile credentials do not have an expiration.
Maybe

AWS_LOGSTREAM_WARN(PROFILE_PROVIDER_LOG_TAG, "refreshRateMs is ignored, profile credentials do not support expiration");

}

ProfileCredentialsProvider::ProfileCredentialsProvider(const char* profile, long refreshRateMs) {
ProfileCredentialsProvider::ProfileCredentialsProvider(const char* profile) {
Aws::Client::ClientConfiguration::CredentialProviderConfiguration credentialsConfig{};
credentialsConfig.profile = profile;
m_impl = std::make_shared<ProfileCredentialsProviderImp>(credentialsConfig);
}

ProfileCredentialsProvider::ProfileCredentialsProvider(const char* profile, long refreshRateMs) : ProfileCredentialsProvider(profile) {
AWS_UNREFERENCED_PARAM(refreshRateMs);
AWS_LOGSTREAM_WARN(PROFILE_PROVIDER_LOG_TAG, "refreshRateMs is ignored, credentials refresh when they expire");
}

ProfileCredentialsProvider::ProfileCredentialsProvider(
const Aws::Client::ClientConfiguration::CredentialProviderConfiguration& credentialsConfig)
: m_impl(std::make_shared<ProfileCredentialsProviderImp>(credentialsConfig)) {}

ProfileCredentialsProvider::ProfileCredentialsProvider(
const Aws::Client::ClientConfiguration::CredentialProviderConfiguration& credentialsConfig, long refreshRateMs)
: m_impl(std::make_shared<ProfileCredentialsProviderImp>(credentialsConfig)) {
: ProfileCredentialsProvider(credentialsConfig) {
AWS_UNREFERENCED_PARAM(refreshRateMs);
AWS_LOGSTREAM_WARN(PROFILE_PROVIDER_LOG_TAG, "refreshRateMs is ignored, credentials refresh when they expire");
}

void ProfileCredentialsProvider::Reload() {}
void ProfileCredentialsProvider::Reload() {
AWS_LOGSTREAM_WARN(PROFILE_PROVIDER_LOG_TAG, "Reload does nothing, credentials refresh when they expire");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
AWS_LOGSTREAM_WARN(PROFILE_PROVIDER_LOG_TAG, "Reload does nothing, credentials refresh when they expire");
AWS_LOGSTREAM_WARN(PROFILE_PROVIDER_LOG_TAG, "Reload does nothing");

}

Aws::String ProfileCredentialsProvider::GetCredentialsProfileFilename() {
return ProfileCredentialsProviderImp::GetCredentialsProfileFilename();
Expand Down
Loading