Skip to content

Commit 97be2eb

Browse files
authored
Merge pull request #139 from stackhpc/upstream/2024.1-2026-03-16
Synchronise 2024.1 with upstream
2 parents a2f4b11 + 0f3fde5 commit 97be2eb

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

.gitreview

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
host=review.opendev.org
33
port=29418
44
project=openstack/cloudkitty.git
5-
defaultbranch=stable/2024.1
5+
defaultbranch=unmaintained/2024.1

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)