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
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"type": "breaking-change",
"category": "aws-cpp-sdk-core",
"contributor": "averyk22",
"description": "Remove ProcessCredentialsProvider and the original ProfileConfigFileAWSCredentialsProvider, which the default chain stopped using once the CRT-backed ProfileCredentialsProvider took over their work. ProfileConfigFileAWSCredentialsProvider still compiles as a deprecated alias of ProfileCredentialsProvider; use ProfileCredentialsProvider for credential_process too. Unlike the old provider, ProfileCredentialsProvider reads the config and credentials files once when it is created; its refreshRateMs is ignored, so keys rotated in the files are picked up only by a new provider. It also follows the shared config file format strictly: a line that starts with whitespace continues the previous property, so a profile line indented by mistake can stop the file from loading. Requests using credential_process now report the profile credentials feature in the user agent instead of the process credentials feature. AWSCredentialsProvider.h no longer includes GeneralHTTPCredentialsProvider.h; include it directly to use GeneralHTTPCredentialsProvider or TaskRoleCredentialsProvider."
}
6 changes: 6 additions & 0 deletions .changelog/breaking-change-remove-s3-encryption-v1-v2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"type": "breaking-change",
"category": "aws-cpp-sdk-s3-encryption",
"contributor": "averyk22",
"description": "Remove the deprecated S3EncryptionClient and S3EncryptionClientV2, along with CryptoConfigurationV2. Use S3EncryptionClientV3 with CryptoConfigurationV3; call AllowLegacy() on the configuration to keep reading objects the older clients wrote. S3EncryptionClientBase's constructors are now protected, so the base client can no longer be built directly with legacy encryption settings."
}
6 changes: 6 additions & 0 deletions .changelog/breaking-change-remove-unused-core-code.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"type": "breaking-change",
"category": "aws-cpp-sdk-core",
"contributor": "averyk22",
"description": "Remove code the SDK never used: Aws::Utils::GetTheLights, the aws/core/utils/memory/stl/AWSMultiMap.h header and aws/core/external/CommonCryptorSPI.h. Aws::MultiMap is still available from aws/core/utils/memory/stl/AWSMap.h."
}
6 changes: 6 additions & 0 deletions .changelog/bugfix-crt-credentials-account-id.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"type": "bugfix",
"category": "aws-cpp-sdk-core",
"contributor": "averyk22",
"description": "CRT-backed credentials providers, including ProfileCredentialsProvider in the default chain, now return the account ID from aws_account_id in the profile and AccountId in credential_process output. Without it, DynamoDB fell back from account-based endpoints to the regional endpoint, and accountIdEndpointMode=required failed."
}
6 changes: 6 additions & 0 deletions .changelog/bugfix-profile-provider-aws-default-profile.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"type": "bugfix",
"category": "aws-cpp-sdk-core",
"contributor": "averyk22",
"description": "ProfileCredentialsProvider's default constructor, used by the default credentials chain, now picks its profile the same way as the rest of the SDK: AWS_DEFAULT_PROFILE, then AWS_PROFILE, then default. It previously ignored AWS_DEFAULT_PROFILE, so credentials and settings like the region could come from different profiles."
}
Original file line number Diff line number Diff line change
Expand Up @@ -146,58 +146,6 @@ namespace Aws
AWSCredentials GetAWSCredentials() override;
};

/**
* Reads credentials profile from the default Profile Config File. Refreshes at set interval for credential rotation.
* Looks for environment variables AWS_SHARED_CREDENTIALS_FILE and AWS_PROFILE. If they aren't found, then it defaults
* to the default profile in ~/.aws/credentials.
* 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:

/**
* Initializes with refreshRateMs as the frequency at which the file is reparsed in milliseconds. Defaults to 5 minutes.
*/
ProfileConfigFileAWSCredentialsProvider(long refreshRateMs = REFRESH_THRESHOLD);

/**
* Initializes with a profile override and
* refreshRateMs as the frequency at which the file is reparsed in milliseconds. Defaults to 5 minutes.
*/
ProfileConfigFileAWSCredentialsProvider(const char* profile, long refreshRateMs = REFRESH_THRESHOLD);

/**
* Retrieves the credentials if found, otherwise returns empty credential set.
*/
AWSCredentials GetAWSCredentials() override;

/**
* Returns the fullpath of the calculated credentials profile file
*/
static Aws::String GetCredentialsProfileFilename();

/**
* Returns the directory storing the profile file.
*/
static Aws::String GetProfileDirectory();

protected:
void Reload() override;
private:

/**
* Checks to see if the refresh interval has expired and reparses the file if it has.
*/
void RefreshIfExpired();

Aws::String m_profileToUse;
Aws::Config::AWSConfigFileProfileConfigLoader m_credentialsFileLoader;
long m_loadFrequencyMs;
};

/**
* Credentials provider implementation that loads credentials from the Amazon
* EC2 Instance Metadata Service.
Expand Down Expand Up @@ -237,51 +185,7 @@ namespace Aws
std::shared_ptr<Aws::Config::AWSProfileConfigLoader> m_ec2MetadataConfigLoader;
long m_loadFrequencyMs;
};

/**
* Process credentials provider that loads credentials by running another command (or program) configured in config file
* The configuration format is as following:
* credential_process = command_path <arguments_list>
* Each time the credentials needs to be refreshed, this command will be executed with configured arguments.
* The default profile name to look up this configuration is "default", same as normal aws credentials configuration and other configurations.
* The expected valid output of the command is a Json doc output to stdout:
* {"Version": 1, "AccessKeyId": "AccessKey123", "SecretAccessKey": "SecretKey321", "SessionToken": "Token123", "Expiration": "1970-01-01T00:00:01Z"}
* The Version key specifies the version of the JSON payload and must be set to 1 for now (as an integer type).
* If the Version key is bumped to 2, SDKs would support both versions of the returned payload.
* Value of Expiration field should be an valid ISO8601 formatted date string as above example.
* The expected error message of the command is a string to output to stderr.
*/
class AWS_CORE_API ProcessCredentialsProvider : public AWSCredentialsProvider
{
public:
/**
* Initializes the provider by checking default profile
*/
ProcessCredentialsProvider();

/**
* Initializes the provider by checking specified profile
* @param profile which profile in config file to use.
*/
ProcessCredentialsProvider(const Aws::String& profile);

/**
* Retrieves the credentials if found, otherwise returns empty credential set.
*/
AWSCredentials GetAWSCredentials() override;

protected:
void Reload() override;
private:
void RefreshIfExpired();

private:
Aws::String m_profileToUse;
Aws::Auth::AWSCredentials m_credentials;
};
} // namespace Auth
} // namespace Aws

// TODO: remove on a next minor API bump from 1.11.x
#endif // !defined(AWS_CLIENT_H)
#include <aws/core/auth/GeneralHTTPCredentialsProvider.h>
#endif // !defined(AWS_CREDENTIALS_PROVIDER)
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@ namespace Aws
};

/**
* Creates an AWSCredentialsProviderChain which uses in order EnvironmentAWSCredentialsProvider, ProfileConfigFileAWSCredentialsProvider,
* ProcessCredentialsProvider, STSAssumeRoleWebIdentityCredentialsProvider and SSOCredentialsProvider.
* Creates an AWSCredentialsProviderChain which uses in order EnvironmentAWSCredentialsProvider, ProfileCredentialsProvider,
* STSAssumeRoleWebIdentityCredentialsProvider and SSOCredentialsProvider.
*/
class AWS_CORE_API DefaultAWSCredentialsProviderChain : public AWSCredentialsProviderChain
{
public:
/**
* Initializes the provider chain with EnvironmentAWSCredentialsProvider, ProfileConfigFileAWSCredentialsProvider,
* ProcessCredentialsProvider, STSAssumeRoleWebIdentityCredentialsProvider and SSOCredentialsProvider in that order.
* Initializes the provider chain with EnvironmentAWSCredentialsProvider, ProfileCredentialsProvider,
* STSAssumeRoleWebIdentityCredentialsProvider and SSOCredentialsProvider in that order.
*/
DefaultAWSCredentialsProviderChain();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,26 @@ namespace Auth {
/**
* CRT-based credentials provider that sources credentials from config files with full SEP compliance.
* Supports assume role, credential_source, role chaining, and all SEP scenarios.
*
* The config and credentials files are read once, when the provider is created. Credentials that expire, such as

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Refresh: documented, not changed: refreshRateMs is ignored and Reload() is empty. The CRT reads the files once, and static keys never expire, so rotated keys need a new provider. Expiring credentials still refresh. Re-reading the files would be a behavior change, so this PR only documents it. Also note: DEFAULT_REFRESH_RATE_MS in the .cpp is really the CRT fetch timeout, not a refresh rate.

* from assume role or credential_process, are refreshed from those settings, but later changes to the files, such
* as rotated keys, are only picked up by a new provider. refreshRateMs is ignored.
*/
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 profile from AWS_DEFAULT_PROFILE, then AWS_PROFILE, then "default". refreshRateMs is ignored.
*/
ProfileCredentialsProvider(long refreshRateMs = REFRESH_THRESHOLD);

/**
* Initializes with a profile override and
* refreshRateMs as the frequency at which the file is reparsed in milliseconds. Defaults to 5 minutes.
* Initializes with a profile override. refreshRateMs is ignored.
*/
ProfileCredentialsProvider(const char* profile, long refreshRateMs = REFRESH_THRESHOLD);

/**
* Initializes from a CredentialProviderConfiguration so settings such as allowSystemProxy can flow through.
* refreshRateMs is ignored.
*/
ProfileCredentialsProvider(const Aws::Client::ClientConfiguration::CredentialProviderConfiguration& config,
long refreshRateMs = REFRESH_THRESHOLD);
Expand All @@ -54,5 +58,7 @@ class AWS_CORE_API ProfileCredentialsProvider : public AWSCredentialsProvider {
class ProfileCredentialsProviderImp;
std::shared_ptr<ProfileCredentialsProviderImp> m_impl;
};

using ProfileConfigFileAWSCredentialsProvider [[deprecated("Use ProfileCredentialsProvider")]] = ProfileCredentialsProvider;
} // namespace Auth
} // namespace Aws
Loading
Loading