[KMS] Support full ARN as TargetKeyId in update_alias#9841
Open
raajheshkannaa wants to merge 4 commits intogetmoto:masterfrom
Open
[KMS] Support full ARN as TargetKeyId in update_alias#9841raajheshkannaa wants to merge 4 commits intogetmoto:masterfrom
raajheshkannaa wants to merge 4 commits intogetmoto:masterfrom
Conversation
Resolve ARN to raw key ID in update_alias using get_key_id(), matching the existing behavior of create_alias. Also fix the _set_alias API handler which incorrectly deleted the alias before calling update_alias, causing a KeyError when the alias could not be found. Fixes getmoto#9831
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #9841 +/- ##
=======================================
Coverage 93.11% 93.12%
=======================================
Files 1308 1308
Lines 118862 118863 +1
=======================================
+ Hits 110684 110688 +4
+ Misses 8178 8175 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
- verify TargetKeyId resolves to key ID (not ARN) after alias update - use ARN in same-target-key test to cover the no-op return path
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
update_aliasnow resolves ARN to raw key ID usingget_key_id(), matching the existingcreate_aliasbehavior_set_aliasAPI handler that incorrectly deleted the alias before callingupdate_alias, causing aKeyErrorwhen the method tried to find and move the aliasNotFoundExceptioninstead of an unhandledKeyErrorAlias.target_key_idwhen moving an alias to a new key solist_aliasesreturns the correct targetTests
test_update_alias_using_arn_as_target_key_id: direct API test for update_alias with full ARNtest_alias_create_and_update_with_arn: CloudFormation test for create + update with full ARNFixes #9831