-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
IAM: Urlencode IAM policies in responses to match AWS #8157
Conversation
There are some repercussions in 3 other tests, I will verify them and the correct behavior tomorrow. |
9222fe2
to
1a195ed
Compare
…t, when coming from cloudformation, fix assertion in test case
1a195ed
to
05a82a9
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #8157 +/- ##
==========================================
- Coverage 94.54% 94.54% -0.01%
==========================================
Files 1158 1158
Lines 100093 100100 +7
==========================================
+ Hits 94633 94639 +6
- Misses 5460 5461 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
So, everything seems to be in order, the TypeError which is not covered is required per specification of the default method, but should never be reached in our case. |
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.
LGTM - thank you @dfangl!
Motivation
Currently, moto does not urlencode (or quote) IAM policy strings in its return values.
While this seemingly matches the AWS behavior, as described here: https://docs.aws.amazon.com/IAM/latest/APIReference/API_GetRolePolicy.html , more investigation shows AWS actually quoting the IAM policies, as shown in responses (printed by boto3 in debug mode):
While this does not impact many users, the disparity shows when you try to set a field in the IAM policies to a urlencoded value, like necessary for matching the resource for the
apigateway.TagResource
operation: https://docs.aws.amazon.com/service-authorization/latest/reference/list_amazonapigatewaymanagement.html#amazonapigatewaymanagement-TagsSince boto3 will unquote the string, it does not matches the input anymore.
Changes