Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitreview
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
host=review.opendev.org
port=29418
project=openstack/cloudkitty.git
defaultbranch=stable/2024.1
defaultbranch=unmaintained/2024.1
15 changes: 10 additions & 5 deletions cloudkitty/common/policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from oslo_policy import opts as policy_opts
from oslo_policy import policy
from oslo_utils import excutils
from oslo_utils import strutils

from cloudkitty.common import policies

Expand Down Expand Up @@ -108,8 +109,9 @@ def authorize(context, action, target):
init()

try:
LOG.debug('Authenticating user with credentials %(credentials)s',
{'credentials': context.to_dict()})
LOG.debug(
'Authenticating user with credentials %(credentials)s',
{'credentials': strutils.mask_dict_password(context.to_dict())})
return _ENFORCER.authorize(action, target, context,
do_raise=True,
exc=PolicyNotAuthorized,
Expand All @@ -120,9 +122,12 @@ def authorize(context, action, target):
LOG.exception('Policy not registered')
except Exception:
with excutils.save_and_reraise_exception():
LOG.error('Policy check for %(action)s failed with credentials '
'%(credentials)s',
{'action': action, 'credentials': context.to_dict()})
LOG.error(
'Policy check for %(action)s failed with credentials '
'%(credentials)s', {
'action': action,
'credentials': strutils.mask_dict_password(
context.to_dict())})


def check_is_admin(context):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
security:
- |
Previously, cloudkitty-api recorded request token in plain text format when
a request does not comply with policy rules or debug log is enabled. This
has been fixed and now token is masked in logs.