Skip to content
This repository was archived by the owner on Mar 31, 2025. It is now read-only.

Commit be8dd97

Browse files
committed
Update Secret repr, add docstring
1 parent 4897789 commit be8dd97

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

clrenv/types.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,14 @@ class Secret(NamedTuple):
1111
value: str
1212

1313
def __repr__(self) -> str:
14-
return self.source
14+
"""
15+
Return a Secret's representation without exposing the secret.
16+
17+
In the event that a Secret's (or, more generally, a ClrEnv object's)
18+
representation is logged, this will prevent us from leaking secrets into
19+
plaintext.
20+
"""
21+
return f"Secret(source='{self.source}')"
1522

1623

1724
# Type that can be read or set as values of leaf nodes.

0 commit comments

Comments
 (0)