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
iamcrossaccount - condition validation correction #1868
iamcrossaccount - condition validation correction #1868
Conversation
joshuaroot
commented
Dec 4, 2017
- setting set_condition iterator to 'c' from 's' as 's' is defined as a parameter of the function. this was causing some issues validating number of keys in the condition.
- setting set_condition iterator to 'c' from 's' as 's' is defined as a parameter of the function. this was causing some issues validating number of keys in the condition.
can you add a test for this as well? |
- adding unittest for 'ForAllValues:StringEquals'
- adding secondary fail test ForAllValues
c7n/filters/iamaccess.py
Outdated
for s in set_conditions: | ||
if not s_cond_op.startswith(s_cond_op): | ||
for c in set_conditions: | ||
if not s_cond_op.startswith(c): |
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.
There is more wrong with this code block, still trying to figure out the correct behavior.
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.
Ok the code needs to change to say if s_cond_op
does not start with at least one of the values in set_conditions, then return. Otherwise if at least one of them matches, keep evaluating.
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.
Bah, I also wrote the ForAllValues wrong. Should be ForAllValues:StringEquals, not just ForAllValues...
Edit: Oh, I see where you said that already.
- changing condition to continue evaluation if any of the set_conditions are at the start of s_cond_op - correcting string in condition 'ForAllValues:StringEquals' - adding unittests for 'ForAnyValues:StringEquals'
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
* condition validation correction - setting set_condition iterator to 'c' from 's' as 's' is defined as a parameter of the function. this was causing some issues validating number of keys in the condition. * adding unittest - adding unittest for 'ForAllValues:StringEquals' * updating unittest - adding secondary fail test ForAllValues * update iamaccess - changing condition to continue evaluation if any of the set_conditions are at the start of s_cond_op - correcting string in condition 'ForAllValues:StringEquals' - adding unittests for 'ForAnyValues:StringEquals'