Improve errors for aws login with an unbound ARN #10036
Merged
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.
During AWS login / renew, vault has logic to try to match the caller's identity against one of the
BoundIamPrincipalARNs
associated with the vault role.The third step of this logic is to try to match any wildcard entries in the
BoundIamPrincipalARNs
for the vault role to the fully-resolved ARN of the caller's identity.In some environments, especially with cross-AWS account logins, resolving the full ARN is unlikely to succeed, which leads to rather confusing error messages:
However, resolving the full ARN only needs to be done if there are any wildcard entries in
BoundIamPrincipalARNs
, since the full ARN is only used in that path.This PR:
BoundIamPrincipalARNs
before trying to resolve the full ARN. If there are none, it immediately returns with an error indicating the vault role is not bound to the caller's ARN, shortcutting the logic to resolve the full ARN (which wouldn't have been used anyway since there are no wildcard entries).