Repository navigation
Share S3 credentials provider across Context and fix anonymous-fallback caching - #297
Open
BrianMichell wants to merge 4 commits into
Open
BrianMichell wants to merge 4 commits into
BrianMichell wants to merge 4 commits into
Conversation
- Only wrap leaf credential providers (Environment, Imds, Profile, EcsRole) in MakeCache in MakeAwsCredentialsProvider; MakeDefault already wraps its internal chain in aws_credentials_provider_new_cached, whereas wrapping the outer [MakeDefault, MakeAnonymous] chain in MakeCache permanently cached UINT64_MAX-expiration anonymous credentials after any initial fallback. - Guard AsProvider, MakeCache, and MakeDefaultWithAnonymous against null aws_credentials_provider pointers. - Add DefaultDoesNotCacheAnonymousFallback unit test.
- Change AwsCredentialsResource from config_only = true to own the live AwsCredentialsProvider in AwsCredentialsResource::Resource, created once per Context resource in AwsCredentialsResource::Create. - Use data_.aws_credentials->credentials_provider in S3KeyValueStoreSpec::DoOpen instead of creating a new provider per open. - Add unit tests verifying provider sharing within a Context and across parent/child Contexts.
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
BrianMichell
force-pushed
the
fix/s3-credentials-share-and-cache
branch
from
October 23, 2026 13:43
4e409a1 to
f3e4980
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two related fixes to how the S3 kvstore resolves AWS credentials.
1. Don't cache the anonymous fallback of the default chain
MakeAwsCredentialsProviderwrapped every provider inaws_credentials_provider_new_cached. Fordefault, the chain falls back to anonymous credentials, which never expire, so the outer cache kept the anonymous result forever: credentials that became available later (env vars, IMDS, profile) were never picked up.MakeCacheis now applied per arm (environment, imds, profile, ecs_role).default(which already caches internally) andanonymousare no longer wrapped.AsProvider,MakeCache, andMakeDefaultWithAnonymousreturnnullptrwhen aws-c-auth fails to construct a provider, instead of dereferencing NULL.MakeAwsCredentialsProviderreports this as an error.2. Share one credentials provider per
aws_credentialscontext resourceBefore,
AwsCredentialsResourcewasconfig_onlyand eachS3KeyValueStoreopened its own provider, so every store re-ran credential resolution (for example IMDS and STS calls). The resource now creates the provider once and every store bound to it reuses it.Visible effects of removing
config_only:aws_credentialsresource is emitted as a context reference instead of inline. Explicit inline specs still round-trip inline.aws_credentialsresource instances.