-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: account id endpoint resolution support #2884
Open
yenfryherrerafeliz
wants to merge
10
commits into
aws:master
Choose a base branch
from
yenfryherrerafeliz:feat_account_id_endpoint_support
base: master
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat: account id endpoint resolution support #2884
yenfryherrerafeliz
wants to merge
10
commits into
aws:master
from
yenfryherrerafeliz:feat_account_id_endpoint_support
Conversation
This file contains 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
yenfryherrerafeliz
force-pushed
the
feat_account_id_endpoint_support
branch
2 times, most recently
from
February 22, 2024 15:57
b7ded3e
to
5c81b98
Compare
stobrien89
requested changes
Feb 22, 2024
yenfryherrerafeliz
force-pushed
the
feat_account_id_endpoint_support
branch
6 times, most recently
from
February 23, 2024 16:45
90fa5a9
to
f732741
Compare
This change add account_id as part of the identity resolution, from the different credentials provider. It also validates whether an account should have been resolved based on the configure option account_id_endpoint_mode. The way this is done is by using lazy resolvers. We wrap the credentials provider into a custom lazy resolver that will avoid resolving credentials more than once, which means that in that credentials lazy resolver the value will be resolved once, and it will be returned everytime the credentials provider is consumed/invoked. For accountId builts-in, we also use a lazy resolver which holds the validation for wheter account_id value should have been resolved as part of the resolved identity. This accountId built-ins lazy resolver is resolved from endpoint resolution.
yenfryherrerafeliz
force-pushed
the
feat_account_id_endpoint_support
branch
from
February 23, 2024 16:54
f732741
to
2ea2504
Compare
stobrien89
requested changes
Feb 23, 2024
For resolving credentials just once per request, and no just once per client initialization, we are adding a middleware that will call forceRefresh method from the CredentialsLazyResolver implementation, and since this middleware will be executed in every request then, the credentials will be fresh per request. We are also fixing here how account_id_endpoint_mode configuration is being resolved.
yenfryherrerafeliz
force-pushed
the
feat_account_id_endpoint_support
branch
4 times, most recently
from
February 27, 2024 16:26
a76722e
to
bdcb928
Compare
yenfryherrerafeliz
force-pushed
the
feat_account_id_endpoint_support
branch
3 times, most recently
from
February 27, 2024 16:33
1a7ed29
to
af2255d
Compare
stobrien89
requested changes
Feb 27, 2024
yenfryherrerafeliz
force-pushed
the
feat_account_id_endpoint_support
branch
3 times, most recently
from
February 28, 2024 14:25
1a13737
to
f8cbcde
Compare
stobrien89
requested changes
Feb 28, 2024
yenfryherrerafeliz
force-pushed
the
feat_account_id_endpoint_support
branch
from
February 29, 2024 18:51
f8cbcde
to
f46873c
Compare
In this change we add AccountId resolution for when AccountId is part of the rulesetParameters and accountIdEndpointMode is not disabled, in EndpointV2Middleware. If AccountId should be resolved then, we will resolve the credentialsProvider, which will resolve an identity from which we will extract the accountId, and if an accountId is not present in that resolved identity then, we will log a warning if accountIdEndpointMode is set to preferred or throw an exception if accountIdEndpointMode is required. Another part of this change is, that if we get up to the point of resolving the credentials provider then, we inject the resolved identity into $command['@context'] as the property 'resolved_identity'. We do this for trying to avoid having to resolve credentials more than once per request.
yenfryherrerafeliz
force-pushed
the
feat_account_id_endpoint_support
branch
from
February 29, 2024 18:54
f46873c
to
afa8033
Compare
yenfryherrerafeliz
force-pushed
the
feat_account_id_endpoint_support
branch
from
March 4, 2024 17:55
4cd1001
to
ae0eb2d
Compare
stobrien89
requested changes
Mar 4, 2024
$credentials = new Credentials( | ||
$result['AccessKeyId'], | ||
$result['SecretAccessKey'], | ||
$result['Token'], | ||
strtotime($result['Expiration']) | ||
strtotime($result['Expiration']), | ||
$accountId |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This still applies
yenfryherrerafeliz
force-pushed
the
feat_account_id_endpoint_support
branch
from
March 5, 2024 16:41
ae0eb2d
to
d6fbe9a
Compare
Addresses feedback for conditionally calling the method resolvingAccountId based on if the parameter is present in the rulesset of the endpoint provider. Include tests coverage for AssumeRoleCredentialProvider, AssumeRoleWithWebIdentityCredentialProvider, process, shared files, and credentials from environment.
yenfryherrerafeliz
force-pushed
the
feat_account_id_endpoint_support
branch
from
March 5, 2024 17:43
d6fbe9a
to
9d5f0c8
Compare
yenfryherrerafeliz
force-pushed
the
feat_account_id_endpoint_support
branch
from
March 11, 2024 15:28
fbd5e4b
to
c6dab51
Compare
yenfryherrerafeliz
force-pushed
the
feat_account_id_endpoint_support
branch
3 times, most recently
from
March 19, 2024 15:25
cad9477
to
c908f46
Compare
stobrien89
requested changes
Mar 19, 2024
The validation of whether account_id should be resolved or not is going to be done by the ruleset, and therefore the validation logic around this needs to be removed.
- Move test cases into a valid existent class. In this case the tests in SourceAccountIdEndpointTest were moved to StsClient class. - Create test for InstanceProfileProvider - Create test for EcsCredentialProvider
yenfryherrerafeliz
force-pushed
the
feat_account_id_endpoint_support
branch
from
March 20, 2024 16:55
c908f46
to
5204f33
Compare
stobrien89
approved these changes
Mar 21, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚢 Ready to ship after ruleset testing. Thanks @yenfryherrerafeliz!
Remove null coalescing operator from the CredentialProvider class in order to prevent Docs Build to fail.
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.
This change add account_id as part of the identity resolution, from the different credentials provider. It also validates whether an account should have been resolved based on the configure option account_id_endpoint_mode, and when this option is not disabled then, it prepends a middleware that resolves the identity, from the provided credential provider and, it validates the account id based on the account_id_endpoint_mode option. When an identity is resolved by this middleware then, this identity is carry over in a command property bag called @context, which is then reused by the signer middleware, and any other middleware that needs to resolve identity. This is done for avoiding having to resolve identity multiple times in a single request. The property is: $command['@context']['resolved_identity'];
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.