)]}'
{"searchlight/elasticsearch/plugins/policy_rbac.py":[{"author":{"_account_id":14680,"name":"Rick Aulino","email":"rick.aulino@hpe.com","username":"ricka"},"change_message_id":"754667cf3cfc1965280ebfe50cf72a2c407290e2","unresolved":false,"context_lines":[{"line_number":43,"context_line":""},{"line_number":44,"context_line":"    elif isinstance(rule, _checks.TrueCheck):"},{"line_number":45,"context_line":"        # \"@\" rule"},{"line_number":46,"context_line":"        return True"},{"line_number":47,"context_line":""},{"line_number":48,"context_line":"    elif isinstance(rule, _checks.NotCheck):"},{"line_number":49,"context_line":"        inner \u003d _policy_to_rbac(rules, rule, creds)"}],"source_content_type":"text/x-python","patch_set":1,"id":"fa7ab95a_669ce60e","line":46,"updated":"2016-09-01 19:05:37.000000000","message":"There is also the \"\" rule, which is always True. Should we check for it here also?","commit_id":"d03da8440ed4277fdfa561766c46aa3308c35d90"},{"author":{"_account_id":10063,"name":"Steve McLellan","email":"steven.j.mclellan@gmail.com","username":"sjmc7"},"change_message_id":"ec629ee4498967948b8e715ef398e0d8ea638b16","unresolved":false,"context_lines":[{"line_number":43,"context_line":""},{"line_number":44,"context_line":"    elif isinstance(rule, _checks.TrueCheck):"},{"line_number":45,"context_line":"        # \"@\" rule"},{"line_number":46,"context_line":"        return True"},{"line_number":47,"context_line":""},{"line_number":48,"context_line":"    elif isinstance(rule, _checks.NotCheck):"},{"line_number":49,"context_line":"        inner \u003d _policy_to_rbac(rules, rule, creds)"}],"source_content_type":"text/x-python","patch_set":1,"id":"fa7ab95a_604be087","line":46,"in_reply_to":"fa7ab95a_669ce60e","updated":"2016-09-01 22:18:12.000000000","message":"\"\" gets treated as TrueCheck as does []","commit_id":"d03da8440ed4277fdfa561766c46aa3308c35d90"},{"author":{"_account_id":14680,"name":"Rick Aulino","email":"rick.aulino@hpe.com","username":"ricka"},"change_message_id":"754667cf3cfc1965280ebfe50cf72a2c407290e2","unresolved":false,"context_lines":[{"line_number":94,"context_line":""},{"line_number":95,"context_line":"    elif isinstance(rule, _checks.RuleCheck):"},{"line_number":96,"context_line":"        # Reference to another rule"},{"line_number":97,"context_line":"        return _policy_to_rbac(rules, rules[rule.match], creds)"},{"line_number":98,"context_line":""},{"line_number":99,"context_line":"    elif isinstance(rule, _checks.RoleCheck):"},{"line_number":100,"context_line":"        if \u0027roles\u0027 in creds:"}],"source_content_type":"text/x-python","patch_set":1,"id":"fa7ab95a_99286c35","line":97,"updated":"2016-09-01 19:05:37.000000000","message":"We should catch the case where rule.match is not a key in the rules dict. For example, if we have this set of rules:\n\n{ \u0027admin_or_owner\u0027: \u0027rule:is_admin and project_id:%(project_id)s\u0027 }\n\nWhen we try to evaluate the rule \u0027admin_or_owner\u0027 we will throw a KeyError, since \u0027rule:is_admin\u0027 is not defined in the incomplete set of rules.\n\nWe should either directly test for this or catch the exception. In either case we should return False.","commit_id":"d03da8440ed4277fdfa561766c46aa3308c35d90"},{"author":{"_account_id":10063,"name":"Steve McLellan","email":"steven.j.mclellan@gmail.com","username":"sjmc7"},"change_message_id":"ec629ee4498967948b8e715ef398e0d8ea638b16","unresolved":false,"context_lines":[{"line_number":94,"context_line":""},{"line_number":95,"context_line":"    elif isinstance(rule, _checks.RuleCheck):"},{"line_number":96,"context_line":"        # Reference to another rule"},{"line_number":97,"context_line":"        return _policy_to_rbac(rules, rules[rule.match], creds)"},{"line_number":98,"context_line":""},{"line_number":99,"context_line":"    elif isinstance(rule, _checks.RoleCheck):"},{"line_number":100,"context_line":"        if \u0027roles\u0027 in creds:"}],"source_content_type":"text/x-python","patch_set":1,"id":"fa7ab95a_006cd433","line":97,"in_reply_to":"fa7ab95a_99286c35","updated":"2016-09-01 22:18:12.000000000","message":"Are you sure? The Rules class implements __missing__ and returns the default rule","commit_id":"d03da8440ed4277fdfa561766c46aa3308c35d90"},{"author":{"_account_id":14680,"name":"Rick Aulino","email":"rick.aulino@hpe.com","username":"ricka"},"change_message_id":"754667cf3cfc1965280ebfe50cf72a2c407290e2","unresolved":false,"context_lines":[{"line_number":96,"context_line":"        # Reference to another rule"},{"line_number":97,"context_line":"        return _policy_to_rbac(rules, rules[rule.match], creds)"},{"line_number":98,"context_line":""},{"line_number":99,"context_line":"    elif isinstance(rule, _checks.RoleCheck):"},{"line_number":100,"context_line":"        if \u0027roles\u0027 in creds:"},{"line_number":101,"context_line":"            return rule.match.lower() in [x.lower() for x in creds[\u0027roles\u0027]]"},{"line_number":102,"context_line":"        return False"}],"source_content_type":"text/x-python","patch_set":1,"id":"fa7ab95a_19d61cf1","line":99,"updated":"2016-09-01 19:05:37.000000000","message":"The OSLO policy code thinks that there can be a substitution in the role definition.\n\nhttps://github.com/openstack/oslo.policy/blob/master/oslo_policy/_checks.py#L216\n\nScanning all of the policy files I have access to, I do not seeing it being used. But if we are setting ourselves up as a pale imitation of all things OSLO policy-wise, we should also do this.\n\n    match \u003d rule.match % creds\n    if \u0027roles\u0027 in creds:\n        match.lower in [x.lower() for x in creds[\u0027roles\u0027]]\n\nI\u0027m assuming that a role with a substitution gets turned into a RoleCheck object and not a GenericCheck object.","commit_id":"d03da8440ed4277fdfa561766c46aa3308c35d90"},{"author":{"_account_id":14680,"name":"Rick Aulino","email":"rick.aulino@hpe.com","username":"ricka"},"change_message_id":"754667cf3cfc1965280ebfe50cf72a2c407290e2","unresolved":false,"context_lines":[{"line_number":103,"context_line":""},{"line_number":104,"context_line":"    elif isinstance(rule, _checks.GenericCheck):"},{"line_number":105,"context_line":"        # Either a substitution (project_id:%(project_id)s) or a literal"},{"line_number":106,"context_line":"        # (project_id:abc)."},{"line_number":107,"context_line":"        try:"},{"line_number":108,"context_line":"            # Try to substitute e.g. %(project_id)s from creds."},{"line_number":109,"context_line":"            # TODO: this won\u0027t work with e.g. %(user.name)s"}],"source_content_type":"text/x-python","patch_set":1,"id":"fa7ab95a_d97594cb","line":106,"updated":"2016-09-01 19:05:37.000000000","message":"Maybe we can break this up into two checks. First we can check if there is a substitution in the rule (i.e. the string has \"%(...)s\" in it). If it is not a substitution, treat it like a literal. Otherwise continue.","commit_id":"d03da8440ed4277fdfa561766c46aa3308c35d90"},{"author":{"_account_id":10063,"name":"Steve McLellan","email":"steven.j.mclellan@gmail.com","username":"sjmc7"},"change_message_id":"ec629ee4498967948b8e715ef398e0d8ea638b16","unresolved":false,"context_lines":[{"line_number":103,"context_line":""},{"line_number":104,"context_line":"    elif isinstance(rule, _checks.GenericCheck):"},{"line_number":105,"context_line":"        # Either a substitution (project_id:%(project_id)s) or a literal"},{"line_number":106,"context_line":"        # (project_id:abc)."},{"line_number":107,"context_line":"        try:"},{"line_number":108,"context_line":"            # Try to substitute e.g. %(project_id)s from creds."},{"line_number":109,"context_line":"            # TODO: this won\u0027t work with e.g. %(user.name)s"}],"source_content_type":"text/x-python","patch_set":1,"id":"fa7ab95a_80cd4433","line":106,"in_reply_to":"fa7ab95a_d97594cb","updated":"2016-09-01 22:18:12.000000000","message":"Maybe. I\u0027m not sure if that would simplify it versus trying to subtitute (which will do nothing if there\u0027s nothing to do)","commit_id":"d03da8440ed4277fdfa561766c46aa3308c35d90"},{"author":{"_account_id":14680,"name":"Rick Aulino","email":"rick.aulino@hpe.com","username":"ricka"},"change_message_id":"754667cf3cfc1965280ebfe50cf72a2c407290e2","unresolved":false,"context_lines":[{"line_number":107,"context_line":"        try:"},{"line_number":108,"context_line":"            # Try to substitute e.g. %(project_id)s from creds."},{"line_number":109,"context_line":"            # TODO: this won\u0027t work with e.g. %(user.name)s"},{"line_number":110,"context_line":"            match \u003d rule.match % creds"},{"line_number":111,"context_line":""},{"line_number":112,"context_line":"        except KeyError:"},{"line_number":113,"context_line":"            # TODO: what to do here? Assume a literal and hope for the best?"}],"source_content_type":"text/x-python","patch_set":1,"id":"fa7ab95a_9c113a07","line":110,"updated":"2016-09-01 19:05:37.000000000","message":"Do we need to worry about recursive definitions in the dictionary? Like a dictionary value being a list. The OSLO policy code does for GenericCheck objects.\n\nhttps://github.com/openstack/oslo.policy/blob/master/oslo_policy/_checks.py#L288","commit_id":"d03da8440ed4277fdfa561766c46aa3308c35d90"},{"author":{"_account_id":10063,"name":"Steve McLellan","email":"steven.j.mclellan@gmail.com","username":"sjmc7"},"change_message_id":"ec629ee4498967948b8e715ef398e0d8ea638b16","unresolved":false,"context_lines":[{"line_number":107,"context_line":"        try:"},{"line_number":108,"context_line":"            # Try to substitute e.g. %(project_id)s from creds."},{"line_number":109,"context_line":"            # TODO: this won\u0027t work with e.g. %(user.name)s"},{"line_number":110,"context_line":"            match \u003d rule.match % creds"},{"line_number":111,"context_line":""},{"line_number":112,"context_line":"        except KeyError:"},{"line_number":113,"context_line":"            # TODO: what to do here? Assume a literal and hope for the best?"}],"source_content_type":"text/x-python","patch_set":1,"id":"fa7ab95a_8066244f","line":110,"in_reply_to":"fa7ab95a_9c113a07","updated":"2016-09-01 22:18:12.000000000","message":"Not sure yet","commit_id":"d03da8440ed4277fdfa561766c46aa3308c35d90"},{"author":{"_account_id":14680,"name":"Rick Aulino","email":"rick.aulino@hpe.com","username":"ricka"},"change_message_id":"754667cf3cfc1965280ebfe50cf72a2c407290e2","unresolved":false,"context_lines":[{"line_number":109,"context_line":"            # TODO: this won\u0027t work with e.g. %(user.name)s"},{"line_number":110,"context_line":"            match \u003d rule.match % creds"},{"line_number":111,"context_line":""},{"line_number":112,"context_line":"        except KeyError:"},{"line_number":113,"context_line":"            # TODO: what to do here? Assume a literal and hope for the best?"},{"line_number":114,"context_line":"            pass"},{"line_number":115,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"fa7ab95a_b90d3040","line":112,"updated":"2016-09-01 19:05:37.000000000","message":"Since we have eliminated literal strings by now, getting here means that the substitution failed. We should return False.","commit_id":"d03da8440ed4277fdfa561766c46aa3308c35d90"},{"author":{"_account_id":10063,"name":"Steve McLellan","email":"steven.j.mclellan@gmail.com","username":"sjmc7"},"change_message_id":"ec629ee4498967948b8e715ef398e0d8ea638b16","unresolved":false,"context_lines":[{"line_number":109,"context_line":"            # TODO: this won\u0027t work with e.g. %(user.name)s"},{"line_number":110,"context_line":"            match \u003d rule.match % creds"},{"line_number":111,"context_line":""},{"line_number":112,"context_line":"        except KeyError:"},{"line_number":113,"context_line":"            # TODO: what to do here? Assume a literal and hope for the best?"},{"line_number":114,"context_line":"            pass"},{"line_number":115,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"fa7ab95a_c0b82c78","line":112,"in_reply_to":"fa7ab95a_b90d3040","updated":"2016-09-01 22:18:12.000000000","message":"Yeah, I\u0027m not 100% sure what this would mean. It might be best to fail out here.","commit_id":"d03da8440ed4277fdfa561766c46aa3308c35d90"},{"author":{"_account_id":14680,"name":"Rick Aulino","email":"rick.aulino@hpe.com","username":"ricka"},"change_message_id":"754667cf3cfc1965280ebfe50cf72a2c407290e2","unresolved":false,"context_lines":[{"line_number":115,"context_line":""},{"line_number":116,"context_line":"        return {\"term\": {rule.kind: match}}"},{"line_number":117,"context_line":""},{"line_number":118,"context_line":"    else:"},{"line_number":119,"context_line":"        raise PolicyRbacException("},{"line_number":120,"context_line":"            \"Don\u0027t know how to interpret policy check rule %s\" %"},{"line_number":121,"context_line":"            rule.__class__.name)"}],"source_content_type":"text/x-python","patch_set":1,"id":"fa7ab95a_9cadba9d","line":118,"updated":"2016-09-01 19:05:37.000000000","message":"Are we going to implement the HttpCheck object?","commit_id":"d03da8440ed4277fdfa561766c46aa3308c35d90"},{"author":{"_account_id":10063,"name":"Steve McLellan","email":"steven.j.mclellan@gmail.com","username":"sjmc7"},"change_message_id":"ec629ee4498967948b8e715ef398e0d8ea638b16","unresolved":false,"context_lines":[{"line_number":115,"context_line":""},{"line_number":116,"context_line":"        return {\"term\": {rule.kind: match}}"},{"line_number":117,"context_line":""},{"line_number":118,"context_line":"    else:"},{"line_number":119,"context_line":"        raise PolicyRbacException("},{"line_number":120,"context_line":"            \"Don\u0027t know how to interpret policy check rule %s\" %"},{"line_number":121,"context_line":"            rule.__class__.name)"}],"source_content_type":"text/x-python","patch_set":1,"id":"fa7ab95a_00af742a","line":118,"in_reply_to":"fa7ab95a_9cadba9d","updated":"2016-09-01 22:18:12.000000000","message":"Not this time round","commit_id":"d03da8440ed4277fdfa561766c46aa3308c35d90"}]}
