You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ran some unit tests that printed out non-unique privileges to see if that would break anything. Looks like we are good to use dicts instead of lists, which should greatly improve speed issues.
importunittestimportjsonfrompolicy_sentry.shared.iam_dataimportiam_definitionclassIAMDataChanges(unittest.TestCase):
deftest_unique_privilege_names_only(self):
list_of_actions= []
forservice_prefixiniam_definition:
forprivilegeiniam_definition[service_prefix].get("privileges"):
list_of_actions.append(f"{service_prefix}:{privilege.get('privilege')}")
set_of_actions=set(list_of_actions)
print(len(list_of_actions))
print(len(set_of_actions))
# 7781 and 7781.# We are good to go. I'll convert it to dictionariesdeftest_unique_resource_names_only(self):
list_of_resources= []
forservice_prefixiniam_definition:
forresourceiniam_definition[service_prefix].get("resources"):
# Even though the resource doesn't have the service prefix included IRL,# this ensures all the list items are unique for our test.list_of_resources.append(f"{service_prefix}:{resource.get('resource')}")
set_of_resources=set(list_of_resources)
print(len(list_of_resources))
print(len(set_of_resources))
# 770 and 770. We are good to godeftest_unique_condition_names_only(self):
list_of_conditions= []
forservice_prefixiniam_definition:
forconditioniniam_definition[service_prefix].get("conditions"):
# Even though the resource doesn't have the service prefix included IRL,# this ensures all the list items are unique for our test.list_of_conditions.append(f"{service_prefix}:{condition.get('condition')}")
set_of_conditions=set(list_of_conditions)
print(len(list_of_conditions))
print(len(set_of_conditions))
# 791 and 790. The only non-unique item is swf:workflowType.name, and if you look at the docs, it is pretty much the same so we won't be losing any valuale information by using this as a dictionary keyextra_condition=set([xforxinlist_of_conditionsiflist_of_conditions.count(x) >1])
print(extra_condition)
Working on this right now. Brb
The text was updated successfully, but these errors were encountered:
…alesforce#242)
* Changes to IAM Definition - so far untested and have not adjusted query methods
* Speed improvements by changing the IAM definition
* Make pylint happy
* Refresh docs and fix tests
* Version bump
Ran some unit tests that printed out non-unique privileges to see if that would break anything. Looks like we are good to use dicts instead of lists, which should greatly improve speed issues.
Working on this right now. Brb
The text was updated successfully, but these errors were encountered: