Skip to content

Commit adb1513

Browse files
Clarify why client_claims and claims are both redacted in add() log
The test comment implied both fields live in event[data] to feed ext_cache_key, but claims is in _EXT_CACHE_KEY_EXCLUDED_FIELDS and does not affect the hash. Reword to distinguish the cache-key-only client_claims pseudo-param from the real OAuth claims wire parameter; both are redacted for log-safety regardless. Test comment only. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent e14b0d5 commit adb1513

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

tests/test_token_cache.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,12 @@ def setUp(self):
5959
TokenCache.CredentialType.ACCESS_TOKEN]
6060

6161
def test_add_redacts_client_claims_in_debug_log(self):
62-
# forwarded_client_claims (and the merged "claims") are kept in
63-
# event["data"] only so they contribute to ext_cache_key. They may carry
64-
# sensitive values, so TokenCache.add()'s DEBUG log must redact them.
62+
# Both fields live in event["data"] for different reasons: the
63+
# cache-key-only "client_claims" pseudo-param contributes to
64+
# ext_cache_key (it is excluded from the wire), while the merged "claims"
65+
# is a real OAuth wire parameter that is excluded from ext_cache_key. Both
66+
# may carry sensitive values, so TokenCache.add()'s DEBUG log must redact
67+
# them regardless of whether they affect the hash.
6568
secret = '{"access_token": {"nbf": {"essential": "SENSITIVE"}}}'
6669
with self.assertLogs("msal.token_cache", level="DEBUG") as cm:
6770
self.cache.add({

0 commit comments

Comments
 (0)