Skip to content

Remove deprecated S3 encryption clients, replaced credentials providers and unused code - #4002

Open
averyk22 wants to merge 3 commits into
release/1.12from
remove-deprecated-apis
Open

averyk22 wants to merge 3 commits into
release/1.12from
remove-deprecated-apis

Conversation

@averyk22

@averyk22 averyk22 commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

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:

  • Did a review by yourself.
  • Added proper tests to cover this PR. (If tests are not applicable, explain.)
  • Checked if this PR is a breaking (APIs have been changed) change.
  • Checked if this PR will not introduce cross-platform inconsistent behavior.
  • Checked if this PR would require a ReadMe/Wiki update.

Check which platforms you have built SDK on to verify the correctness of this PR.

  • Linux
  • Windows
  • Android
  • MacOS
  • IOS
  • Other Platforms

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@averyk22 averyk22 changed the title Remove the deprecated S3 encryption clients and unused core code Remove deprecated S3 encryption clients, replaced credentials providers and unused code Nov 16, 2026
credentials.SetExpiration(DateTime{expiration});
const auto sessionTokenCursor = crtCredentials.GetSessionToken();
credentials.SetSessionToken({reinterpret_cast<char*>(sessionTokenCursor.ptr), sessionTokenCursor.len});
const auto accountIdCursor = crtCredentials.GetAccountId();

@averyk22 averyk22 Nov 16, 2026 •

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.

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();

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.

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

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.


credsFile << "[default_profile]" << std::endl;
credsFile << " aws_access_key_id = DefaultProfileAccessKey " << std::endl;
credsFile << "aws_access_key_id = DefaultProfileAccessKey " << std::endl;

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.

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.

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.

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.

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.

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.
@averyk22
averyk22 force-pushed the remove-deprecated-apis branch from dabb3ee to 4fdc324 Compare November 19, 2026 16:12

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants