-
Notifications
You must be signed in to change notification settings - Fork 4.3k
fix(iam): deterministic ordering for overflow policy statements #35876
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
fix(iam): deterministic ordering for overflow policy statements #35876
Conversation
Sort policy statements deterministically to prevent service interruption during overflow policy updates. This ensures identical statements always end up in the same overflow policies across deployments. Fixes aws#35611 Signed-off-by: puretension <rlrlfhtm5@gmail.com>
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 review is outdated)
|
Exemption Request This fix addresses a deterministic ordering issue in policy statement processing that prevents service interruptions during deployments. The change is:
The core issue was non-deterministic behavior causing statements to move between policies unpredictably. This fix ensures deterministic behavior - the same input always produces the same output structure, eliminating the root cause of service interruptions. An integration test would not add meaningful validation beyond what the unit test already provides, as the AWS resource configurations and their final states remain identical. |
Signed-off-by: puretension <rlrlfhtm5@gmail.com>
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
|
Thanks @rix0rrr! You raise a good point that when adding statements, statements may not be added to the end of the list under this fix, but it could be added in the middle. Hence, deployed statements that are the end of the policies would now have to be shifted to a new policy document. This situation is what can cause an inconsistent deployment so I don't see how sorting statements can fix and close issue #36511. @puretension, thank you for attempting to fix this. However, I see that the direction this PR takes is incorrect. I'll have to close this PR accordingly. I've unlocked the conversation in case you have any comments. |
|
Comments on closed issues and PRs are hard for our team to see. |

Issue # (if applicable)
Closes #35611.
Reason for this change
IAM roles generate overflow policies when their policy document exceeds 10k bytes, splitting statements into managed policies. The ordering of statements was non-deterministic, causing statements to move between policies during deployments, leading to temporary permission gaps and potential service interruptions.
Description of changes
PolicyDocument._splitDocument()Describe any new or updated permissions being added
No new or updated IAM permissions are needed.
Description of how you validated changes
overflow policies have deterministic statement orderingthat verifies identical policy structures across multiple deploymentsChecklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license