Repository navigation
Conversation
| credentials.SetExpiration(DateTime{expiration}); | ||
| const auto sessionTokenCursor = crtCredentials.GetSessionToken(); | ||
| credentials.SetSessionToken({reinterpret_cast<char*>(sessionTokenCursor.ptr), sessionTokenCursor.len}); | ||
| const auto accountIdCursor = crtCredentials.GetAccountId(); |
There was a problem hiding this comment.
Users can set aws_account_id in their profile, or have their credential_process command return
AccountId, so DynamoDB uses its account-based endpoints. ProfileCredentialsProvider, which the
default chain uses and which replaces the providers removed in this PR, read the account ID
through the CRT but never copied it into AWSCredentials, so the SDK silently ignored it: in the
default preferred mode DynamoDB fell back to the regional endpoint, and required mode failed.
The removed providers still returned it, so this fix keeps the account ID working once they're
gone.
| CredentialsProviderProfileConfig config; | ||
| return CredentialsProvider::CreateCredentialsProviderProfile(config); | ||
| Aws::Client::ClientConfiguration::CredentialProviderConfiguration credentialsConfig{}; | ||
| credentialsConfig.profile = Aws::Auth::GetConfigProfileName(); |
There was a problem hiding this comment.
Keeping AWS_DEFAULT_PROFILE: The CRT only reads AWS_PROFILE, so the no-argument constructor ignored AWS_DEFAULT_PROFILE, while the configuration constructor and the rest of the SDK (region, SSO, STS) honor it first. This keeps the old provider's behavior and keeps credentials and settings from the same profile. Dropping AWS_DEFAULT_PROFILE would be a separate SDK-wide decision.
| * 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 |
There was a problem hiding this comment.
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.
|
|
||
| credsFile << "[default_profile]" << std::endl; | ||
| credsFile << " aws_access_key_id = DefaultProfileAccessKey " << std::endl; | ||
| credsFile << "aws_access_key_id = DefaultProfileAccessKey " << std::endl; |
There was a problem hiding this comment.
Test fixtures: These lines had leading whitespace. The shared config format reads that as a continuation of the previous property, and the CRT follows it, so the whole file failed to load. The old parser was lenient.
| configFile << "credential_process = echo " << WrapEchoStringWithSingleQuoteForUnixShell("{\"Version\": 1, \"AccessKeyId\": \"honky\", \"SecretAccessKey\": \"tonk\", \"SecretAccessKey\": \"woman\", \"AccountId\": \"faye\"}") << std::endl; | ||
| configFile.close(); | ||
| Environment::EnvironmentRAII envVars{{{CONFIGURATION_FILE_ENV_VAR, configFile.GetFileName().c_str()}}}; | ||
| // ProfileCredentialsProvider also reads the credentials file, so point it at an empty one to keep a local [default] from taking over. |
There was a problem hiding this comment.
Test isolation: This test only redirected the config file, so with ProfileCredentialsProvider a local ~/.aws/credentials [default] won over credential_process. CredentialTrackingTest had the same gap and now also asserts the key came from the process.
| RunTestWithCredentialsProvider(std::move(credsProvider), "v"); | ||
| auto credsProvider = Aws::MakeShared<Aws::Auth::ProfileCredentialsProvider>(TEST_LOG_TAG); | ||
| ASSERT_STREQ("test-process-key", credsProvider->GetAWSCredentials().GetAWSAccessKeyId().c_str()); | ||
| // TODO: ProfileCredentialsProvider reports CREDENTIALS_PROFILE ("n") even when credentials come from credential_process; restore "v" once it reports the source. |
There was a problem hiding this comment.
Known gap: ProfileCredentialsProvider reports CREDENTIALS_PROFILE even for credential_process. Follow-up to restore v.
Remove S3EncryptionClient, S3EncryptionClientV2 and CryptoConfigurationV2, and make S3EncryptionClientBase's constructors protected so the base can't be built directly with legacy encryption settings. The V1/V2-write, V3-read integration tests now write legacy objects through a test-only subclass of the base. Remove Aws::Utils::GetTheLights, AWSMultiMap.h and CommonCryptorSPI.h, which nothing used. Aws::MultiMap stays in AWSMap.h because URI.h uses it. The credential provider removals are held back: ProfileCredentialsProvider does not yet return the account ID from the credentials file or credential_process, so it cannot replace them.
CrtCredentialsProvider::ExtractCredentialsFromCrt never copied the CRT's account ID, so every CRT-backed provider, including ProfileCredentialsProvider in the default chain, dropped aws_account_id from the profile and AccountId from credential_process output. DynamoDB then fell back from account-based endpoints to the regional endpoint, and accountIdEndpointMode=required failed. ProfileCredentialsProvider's default constructor let the CRT pick the profile from AWS_PROFILE alone, while the rest of the SDK, and its own configuration constructor, use GetConfigProfileName(), which checks AWS_DEFAULT_PROFILE first. It now uses GetConfigProfileName() too. Document that ProfileCredentialsProvider reads the files once and ignores refreshRateMs.
Remove ProcessCredentialsProvider and the original ProfileConfigFileAWSCredentialsProvider. The default chain stopped using them once the CRT-backed ProfileCredentialsProvider took over their work, and with the account ID and AWS_DEFAULT_PROFILE fixes it now covers what they did, apart from re-reading the files on refreshRateMs. ProfileConfigFileAWSCredentialsProvider stays as a deprecated alias of ProfileCredentialsProvider. GetCredentialsFromProcess stays, since STSProfileCredentialsProvider uses it. Drop the GeneralHTTPCredentialsProvider.h include that AWSCredentialsProvider.h kept for 1.11 compatibility. Move the tests to ProfileCredentialsProvider: remove leading whitespace that the shared config format reads as a continuation line, drop the reload check and the ProcessCredentialsProvider tests, and point the credential_process tests at an empty credentials file so a local [default] can't take over.
dabb3ee to
4fdc324
Compare
Issue #, if available:
Description of changes:
S3 encryption: Remove S3EncryptionClient, S3EncryptionClientV2 and CryptoConfigurationV2, and make S3EncryptionClientBase's constructors protected so the base can't be built directly with legacy encryption settings. The V1/V2-write, V3-read integration tests now write legacy objects through a test-only subclass of the base.
Credentials providers: Remove ProcessCredentialsProvider and the original ProfileConfigFileAWSCredentialsProvider; ProfileConfigFileAWSCredentialsProvider stays as a deprecated alias of ProfileCredentialsProvider. Before removing them, fix two gaps in ProfileCredentialsProvider that the old providers covered (3d22bb5): it dropped the account ID, and its default constructor ignored AWS_DEFAULT_PROFILE. AWSCredentialsProvider.h also drops the GeneralHTTPCredentialsProvider.h include kept for 1.11.
Unused code: Remove Aws::Utils::GetTheLights, AWSMultiMap.h and CommonCryptorSPI.h. Aws::MultiMap stays in AWSMap.h because URI.h uses it.
Not run locally: the s3-encryption integration tests, which need AWS resources.
Check all that applies:
Check which platforms you have built SDK on to verify the correctness of this PR.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.