Skip to content

Commit 4bb92c2

Browse files
PYTHON-4468 Hide the value of sensitive subtype binary objects
1 parent 1d6cf42 commit 4bb92c2

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

bson/binary.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,4 +364,7 @@ def __ne__(self, other: Any) -> bool:
364364
return not self == other
365365

366366
def __repr__(self) -> str:
367-
return f"Binary({bytes.__repr__(self)}, {self.__subtype})"
367+
if self.__subtype == SENSITIVE_SUBTYPE:
368+
return f"Binary('<redacted>', {self.__subtype})"
369+
else:
370+
return f"Binary({bytes.__repr__(self)}, {self.__subtype})"

doc/contributors.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,3 +100,4 @@ The following is a list of people who have contributed to
100100
- Stephan Hof (stephan-hof)
101101
- Casey Clements (caseyclements)
102102
- Ivan Lukyanchikov (ilukyanchikov)
103+
- Terry Patterson

0 commit comments

Comments
 (0)