Skip to content

Commit a55df58

Browse files
authored
Merge pull request #140 from stackhpc/upstream/2023.1-2026-03-16
Synchronise 2023.1 with upstream
2 parents 3c91a1e + 9a4c01d commit a55df58

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

cloudkitty/common/policy.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
from oslo_policy import opts as policy_opts
2424
from oslo_policy import policy
2525
from oslo_utils import excutils
26+
from oslo_utils import strutils
2627

2728
from cloudkitty.common import policies
2829

@@ -108,8 +109,9 @@ def authorize(context, action, target):
108109
init()
109110

110111
try:
111-
LOG.debug('Authenticating user with credentials %(credentials)s',
112-
{'credentials': context.to_dict()})
112+
LOG.debug(
113+
'Authenticating user with credentials %(credentials)s',
114+
{'credentials': strutils.mask_dict_password(context.to_dict())})
113115
return _ENFORCER.authorize(action, target, context,
114116
do_raise=True,
115117
exc=PolicyNotAuthorized,
@@ -120,9 +122,12 @@ def authorize(context, action, target):
120122
LOG.exception('Policy not registered')
121123
except Exception:
122124
with excutils.save_and_reraise_exception():
123-
LOG.error('Policy check for %(action)s failed with credentials '
124-
'%(credentials)s',
125-
{'action': action, 'credentials': context.to_dict()})
125+
LOG.error(
126+
'Policy check for %(action)s failed with credentials '
127+
'%(credentials)s', {
128+
'action': action,
129+
'credentials': strutils.mask_dict_password(
130+
context.to_dict())})
126131

127132

128133
def check_is_admin(context):
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
security:
3+
- |
4+
Previously, cloudkitty-api recorded request token in plain text format when
5+
a request does not comply with policy rules or debug log is enabled. This
6+
has been fixed and now token is masked in logs.

0 commit comments

Comments
 (0)