)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"212756db4a399f73079e65a1f6f9d4030569a15e","unresolved":false,"context_lines":[{"line_number":26,"context_line":"2) It eschews the use of Python\u0027s string formatting which may not"},{"line_number":27,"context_line":"fully dump the contents of the dicts and is not easily parsed in favor"},{"line_number":28,"context_line":"of using JSON format which does fully capture the object\u0027s content and"},{"line_number":29,"context_line":"can be used in data exchange (and can be read by oslopolicy-checker)."},{"line_number":30,"context_line":""},{"line_number":31,"context_line":"Closes-Bug: #1804073"},{"line_number":32,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"3f79a3b5_febc316c","line":29,"updated":"2018-11-21 15:03:18.000000000","message":"We have a JSON formatter in the logging library so anyone who wants machine readable logs can use that. For the standard message case I think we want to make it easy for humans to read and then add the extra data to the log call extras argument for the machine readable case.","commit_id":"fc88d73bfa81811ea38315073d0097f12fd7978b"},{"author":{"_account_id":8116,"name":"John Dennis","email":"jdennis@redhat.com","username":"jdennis"},"change_message_id":"d78dcff3e1c4ab6dc54734e98442bc855d6f1daa","unresolved":false,"context_lines":[{"line_number":26,"context_line":"2) It eschews the use of Python\u0027s string formatting which may not"},{"line_number":27,"context_line":"fully dump the contents of the dicts and is not easily parsed in favor"},{"line_number":28,"context_line":"of using JSON format which does fully capture the object\u0027s content and"},{"line_number":29,"context_line":"can be used in data exchange (and can be read by oslopolicy-checker)."},{"line_number":30,"context_line":""},{"line_number":31,"context_line":"Closes-Bug: #1804073"},{"line_number":32,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"3f79a3b5_39140399","line":29,"in_reply_to":"3f79a3b5_febc316c","updated":"2018-11-21 15:45:35.000000000","message":"Humans can read JSON easier than Python\u0027s __repr__ formatting which is what you get when you request a string representation and there isn\u0027t a custom __str__ method on the object. But that is less of an issue than the fact that invoking a string representation actually loses critical data that is being utilized thus making it unfit for the purpose of debugging. This occurs whenever a class does not have a custom __str__() method (i.e. falls back to Python\u0027s internal __repr__) or has a custom __str__ or __repr__ that omits data.\n\nWe want to be able to use oslopolicy-checker as a tool to debug and validate policy. For this to work we need both a complete dump of the data and for the data to be in JSON format. Asking customers to reconfigure their logging just to be able to get a few select pieces of data and then restore their logging configuration seems like a needless hurdle.","commit_id":"fc88d73bfa81811ea38315073d0097f12fd7978b"}],"oslo_policy/policy.py":[{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"212756db4a399f73079e65a1f6f9d4030569a15e","unresolved":false,"context_lines":[{"line_number":841,"context_line":"        LOG.debug(\u0027enforce: rule\u003d%s creds\u003d%s target\u003d%s\u0027,"},{"line_number":842,"context_line":"                  rule.__class__ if isinstance(rule, _checks.BaseCheck)"},{"line_number":843,"context_line":"                  else \u0027\"%s\"\u0027 % rule,"},{"line_number":844,"context_line":"                  jsonutils.dumps(creds, skipkeys\u003dTrue, sort_keys\u003dTrue),"},{"line_number":845,"context_line":"                  jsonutils.dumps(target, skipkeys\u003dTrue, sort_keys\u003dTrue))"},{"line_number":846,"context_line":""},{"line_number":847,"context_line":"        # Allow the rule to be a Check tree"}],"source_content_type":"text/x-python","patch_set":1,"id":"3f79a3b5_7efa6144","line":844,"updated":"2018-11-21 15:03:18.000000000","message":"This is going to dump credentials to the logs, which we typically consider to be a security violation. We have some code in oslo_utils.strutils to sanitize some values, but in this case we know what is in the dict so it may be just as easy to be more explicit about which values we log, so that we only log identifying information and do not include tokens or passwords or anything like that.","commit_id":"fc88d73bfa81811ea38315073d0097f12fd7978b"},{"author":{"_account_id":2218,"name":"Adam Young","email":"adam@younglogic.com","username":"ayoung"},"change_message_id":"5576c94ae341e705313ec1544553eb1f90d0df17","unresolved":false,"context_lines":[{"line_number":841,"context_line":"        LOG.debug(\u0027enforce: rule\u003d%s creds\u003d%s target\u003d%s\u0027,"},{"line_number":842,"context_line":"                  rule.__class__ if isinstance(rule, _checks.BaseCheck)"},{"line_number":843,"context_line":"                  else \u0027\"%s\"\u0027 % rule,"},{"line_number":844,"context_line":"                  jsonutils.dumps(creds, skipkeys\u003dTrue, sort_keys\u003dTrue),"},{"line_number":845,"context_line":"                  jsonutils.dumps(target, skipkeys\u003dTrue, sort_keys\u003dTrue))"},{"line_number":846,"context_line":""},{"line_number":847,"context_line":"        # Allow the rule to be a Check tree"}],"source_content_type":"text/x-python","patch_set":1,"id":"3f79a3b5_0e621c16","line":844,"in_reply_to":"3f79a3b5_1945879c","updated":"2018-11-21 17:22:33.000000000","message":"Lets see what we get in a tempest run when this is enabled.  It might be a non-issue.  The Keystone side is not going to have passwords.  The only place I can think of where there might be sensitive info is Barbican, but that should not be the case.  There should be no sensitive info sent to oslo policy.\n\nOperative word being \"should\" of course.","commit_id":"fc88d73bfa81811ea38315073d0097f12fd7978b"},{"author":{"_account_id":2903,"name":"Morgan Fainberg","email":"morgan.fainberg@gmail.com","username":"mdrnstm"},"change_message_id":"d4d4ddc6b0d02e3dc610710d2b7956450a82f202","unresolved":false,"context_lines":[{"line_number":841,"context_line":"        LOG.debug(\u0027enforce: rule\u003d%s creds\u003d%s target\u003d%s\u0027,"},{"line_number":842,"context_line":"                  rule.__class__ if isinstance(rule, _checks.BaseCheck)"},{"line_number":843,"context_line":"                  else \u0027\"%s\"\u0027 % rule,"},{"line_number":844,"context_line":"                  jsonutils.dumps(creds, skipkeys\u003dTrue, sort_keys\u003dTrue),"},{"line_number":845,"context_line":"                  jsonutils.dumps(target, skipkeys\u003dTrue, sort_keys\u003dTrue))"},{"line_number":846,"context_line":""},{"line_number":847,"context_line":"        # Allow the rule to be a Check tree"}],"source_content_type":"text/x-python","patch_set":1,"id":"3f79a3b5_99dc3717","line":844,"in_reply_to":"3f79a3b5_7efa6144","updated":"2018-11-21 15:37:18.000000000","message":"At what point can we log debug level with raw data (real question)? We cannot scrub all logs everywhere. If this is a debug level we\u0027re reinforcing the concept that debug may drop secure data into logs, which may be fine or it may not be fine.\n\nIt\u0027s impossible to know everything that needs to be scrubbed/masked. According to the VMT taxonomy (see Taxonomy, https://security.openstack.org/vmt-process.html#incident-report-taxonomy ) this would be a a B3 if data leaked as \"Debug\" has historically not meant for production use.\n\nUnfortunately, we really do not know what is in this dict. The dict is populated by the services and could contain any data. We never populate the password itself (or other auth-security bits) as the APIs that handle auth are not run through oslo.policy.\n\nThis is a difficult line to balance. We might want (long term) to expand on the oslo.log and have an \"insecure_debug\" which we wrap specific loggers with (e.g. this one) and unless insecure_debug is enabled, we do not log the data.\n\nAn alternative could be moving this log down to the Trace Level (e.g. \"really really don\u0027t use in production unless you need deep down data information\")\n\nIn short, I don\u0027t think it\u0027s straight forward/easy to filter/mask. This is the right place for this type of logging. \n\nThe easiest mechanism is to load in oslo_utils.strutils and run the data through mask_password. It will at least catch passwords/token_ids.","commit_id":"fc88d73bfa81811ea38315073d0097f12fd7978b"},{"author":{"_account_id":8116,"name":"John Dennis","email":"jdennis@redhat.com","username":"jdennis"},"change_message_id":"d78dcff3e1c4ab6dc54734e98442bc855d6f1daa","unresolved":false,"context_lines":[{"line_number":841,"context_line":"        LOG.debug(\u0027enforce: rule\u003d%s creds\u003d%s target\u003d%s\u0027,"},{"line_number":842,"context_line":"                  rule.__class__ if isinstance(rule, _checks.BaseCheck)"},{"line_number":843,"context_line":"                  else \u0027\"%s\"\u0027 % rule,"},{"line_number":844,"context_line":"                  jsonutils.dumps(creds, skipkeys\u003dTrue, sort_keys\u003dTrue),"},{"line_number":845,"context_line":"                  jsonutils.dumps(target, skipkeys\u003dTrue, sort_keys\u003dTrue))"},{"line_number":846,"context_line":""},{"line_number":847,"context_line":"        # Allow the rule to be a Check tree"}],"source_content_type":"text/x-python","patch_set":1,"id":"3f79a3b5_b9d7b321","line":844,"in_reply_to":"3f79a3b5_7efa6144","updated":"2018-11-21 15:45:35.000000000","message":"Naming this parameter \"credentials\" was unfortunate, it\u0027s not credentials, rather it\u0027s auth context data which doesn\u0027t or shouldn\u0027t contain password information. However your point is taken and we should proactively protect against revealing passwords so I\u0027ll update the patch to call oslo_utils.strutils.mask_dict_password().\n\nActually we don\u0027t know what is in this dict, it\u0027s up to the caller and this data has a tendency to change across versions and likely across the projects that call it.\n\nThe whole point of this logging to to be able to debug policy failures, something that is increasingly becoming a problem as more and more deployments are overriding default policy with their own. If we can\u0027t capture the input we can\u0027t debug it.","commit_id":"fc88d73bfa81811ea38315073d0097f12fd7978b"},{"author":{"_account_id":2903,"name":"Morgan Fainberg","email":"morgan.fainberg@gmail.com","username":"mdrnstm"},"change_message_id":"b3d7e3cd5a1e907d06afbb6ee446f2c131675a03","unresolved":false,"context_lines":[{"line_number":841,"context_line":"        LOG.debug(\u0027enforce: rule\u003d%s creds\u003d%s target\u003d%s\u0027,"},{"line_number":842,"context_line":"                  rule.__class__ if isinstance(rule, _checks.BaseCheck)"},{"line_number":843,"context_line":"                  else \u0027\"%s\"\u0027 % rule,"},{"line_number":844,"context_line":"                  jsonutils.dumps(creds, skipkeys\u003dTrue, sort_keys\u003dTrue),"},{"line_number":845,"context_line":"                  jsonutils.dumps(target, skipkeys\u003dTrue, sort_keys\u003dTrue))"},{"line_number":846,"context_line":""},{"line_number":847,"context_line":"        # Allow the rule to be a Check tree"}],"source_content_type":"text/x-python","patch_set":1,"id":"3f79a3b5_1945879c","line":844,"in_reply_to":"3f79a3b5_b9d7b321","updated":"2018-11-21 15:47:08.000000000","message":"Lets make sure we run creds and target through mask_password / mask_dict_password. That should solve the immediate concern(s)","commit_id":"fc88d73bfa81811ea38315073d0097f12fd7978b"},{"author":{"_account_id":2903,"name":"Morgan Fainberg","email":"morgan.fainberg@gmail.com","username":"mdrnstm"},"change_message_id":"adfa2eb41f34f7a3f76200a0795ac5031ba6686e","unresolved":false,"context_lines":[{"line_number":831,"context_line":"        # collections.MutableMapping, which behaves like a dictionary but"},{"line_number":832,"context_line":"        # doesn\u0027t pass the type check."},{"line_number":833,"context_line":"        elif isinstance(creds, collections.MutableMapping):"},{"line_number":834,"context_line":"            # NOTE(jdennis) Although a MutableMapping behaves like a dict"},{"line_number":835,"context_line":"            # oslo.strutils.mask_dict_password() requires a dict."},{"line_number":836,"context_line":"            # Bug #1804528 was opened against oslo.strutils.mask_dict_password."},{"line_number":837,"context_line":"            # Once that bug is fixed the conversion to dict can be removed."},{"line_number":838,"context_line":"            creds \u003d dict(creds)"},{"line_number":839,"context_line":"        else:"},{"line_number":840,"context_line":"            msg \u003d ("},{"line_number":841,"context_line":"                \u0027Expected type oslo_context.context.RequestContext, dict, or  \u0027"}],"source_content_type":"text/x-python","patch_set":2,"id":"3f79a3b5_1309d181","line":838,"range":{"start_line":834,"start_character":0,"end_line":838,"end_character":31},"updated":"2018-11-22 15:12:23.000000000","message":"As a NIT, I probably would only convert to a dict in the log.debug, I would also gate the debug on logger being actually set to debug explicitly, meaning the conversion isn\u0027t done unless needed.\n\nWith all that said, This is 100% ok as is, and no changes are needed.\n\nI\u0027ll circle up and provide a score once we get the tests passing (looks like this is dependent on a change to fix test_shell)","commit_id":"ccab2938cb4869b367e1b3f4649d055b91e428fd"},{"author":{"_account_id":5046,"name":"Lance Bragstad","email":"lbragstad@redhat.com","username":"ldbragst"},"change_message_id":"e237a8b3ec832213c7dce57a64d4edafabe5826c","unresolved":false,"context_lines":[{"line_number":848,"context_line":"        LOG.debug(\u0027enforce: rule\u003d%s creds\u003d%s target\u003d%s\u0027,"},{"line_number":849,"context_line":"                  rule.__class__ if isinstance(rule, _checks.BaseCheck)"},{"line_number":850,"context_line":"                  else \u0027\"%s\"\u0027 % rule,"},{"line_number":851,"context_line":"                  jsonutils.dumps(strutils.mask_dict_password(creds),"},{"line_number":852,"context_line":"                                  skipkeys\u003dTrue, sort_keys\u003dTrue),"},{"line_number":853,"context_line":"                  jsonutils.dumps(target, skipkeys\u003dTrue, sort_keys\u003dTrue))"},{"line_number":854,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"3f79a3b5_3bec6904","line":851,"updated":"2018-11-29 22:49:51.000000000","message":"This appears to be causing a circular reference issue.\n\nhttp://logs.openstack.org/60/619260/2/check/tempest-full/c81cd76/controller/logs/screen-q-svc.txt.gz?level\u003dERROR#_Nov_27_22_42_41_741357","commit_id":"ccab2938cb4869b367e1b3f4649d055b91e428fd"}]}
