fix(iam): derive every IAM ARN's partition from the region - #2556
Merged
Merged
Conversation
Users, roles, policies, instance profiles and MFA devices already build their ARN with the region's partition, but groups (create and rename), OIDC and SAML providers, server certificates (upload and rename), the credential report's root row, the policy-simulation root fallback and the web-identity fallback provider all hardcoded arn:aws:. In a China or GovCloud region those entities disagreed with the rest of the account. ChangePassword parsed its caller only from an arn:aws:iam:: prefix, so an aws-cn or aws-us-gov user fell through to the anonymous no-op path and got a success without the old password being checked or the new one written. Parse the principal partition-agnostically.
…s in any partition UpdateGroup and UpdateServerCertificate rebuilt the ARN from the rename request's region. IAM is global, so a rename from a commercial region flipped a cn-/us-gov-/iso- entity to arn:aws:. Take the partition from the stored ARN, falling back to the region, as UpdateUser already did; the three share one helper now. The pass-role trust check and the policy evaluator's account-root classification only parsed arn:aws:iam::, so role ARNs and :root principals in other partitions were not recognized.
vieiralucas
force-pushed
the
fix/iam-arn-partition
branch
from
September 24, 2026 22:39
814b21f to
804e332
Compare
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
Found while fixing #2552. Users, roles, policies, instance profiles and MFA devices already build their ARN with the region's partition (
aws-cn,aws-us-gov,aws-iso*), but several other IAM ARNs hardcodedarn:aws:, so in a China/GovCloud/ISO region they disagreed with the rest of the account.Minted ARNs now use the region's partition:
CreateGroupCreateOpenIDConnectProvider,CreateSAMLProviderUploadServerCertificateAssumeRoleWithWebIdentityfallback provider ARNRenames keep the stored partition:
UpdateGroupandUpdateServerCertificaterebuild the ARN from the entity's existing partition (falling back to the region), asUpdateUseralready did. IAM is global, so a rename can arrive from any region; the three now share oneexisting_arn_partitionhelper.ARN parsing accepts any partition:
ChangePasswordonly resolved its caller fromarn:aws:iam::, so anaws-cn/aws-us-govuser fell through to the anonymous no-op path and got a success without the old password being checked or the new one written.role_name_from_arnand the evaluator's account-root classification (arn:<p>:iam::<acct>:root) likewise only matchedaws.No surface changes: no new API, flag, or SDK field; default-region (
aws) output is unchanged, so conformance/docs/counts are unaffected.Test plan
entity_arns_carry_region_partition: group create/rename, OIDC, SAML, server cert upload/rename, credential report root row incn-north-1all emitarn:aws-cn:.rename_from_other_region_keeps_partition: group + server cert created incn-north-1, renamed fromus-east-1, keepaws-cn.change_password_resolves_non_aws_partition_principal: wrong old password rejected, right one accepted, for anaws-cnprincipal.classify_aws_principal_recognizes_root_arn_in_any_partition, extendedparses_role_name_from_arn.cargo test -p fakecloud-iam(556 pass), e2eiam+iam_enforcementpass, clippy clean.Summary by cubic
Now that users, roles, policies, instance profiles, and MFA devices already derive their ARN partition from the region, this change makes the remaining IAM ARNs do the same so entities created in China, GovCloud, or ISO regions no longer disagree with the rest of the account.
arn:<partition>:instead of hardcodedarn:aws:.UpdateUserworks.ChangePasswordnow resolves principals from any partition; before,aws-cn/aws-us-govcallers were treated as anonymous and got a success without the old password being checked.No new API, flag, or SDK field. Default-region output is unchanged.
Written for commit 804e332. Summary will update on new commits.