mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-12 23:01:41 +00:00
fix: enable secret redaction by default, use LITELLM_DISABLE_REDACT_SECRETS to opt out
This commit is contained in:
parent
bd16532431
commit
ff5bd96b59
2 changed files with 3 additions and 3 deletions
|
|
@ -17,7 +17,7 @@ if set_verbose is True:
|
|||
"`litellm.set_verbose` is deprecated. Please set `os.environ['LITELLM_LOG'] = 'DEBUG'` for debug logs."
|
||||
)
|
||||
|
||||
_ENABLE_SECRET_REDACTION = os.getenv("LITELLM_REDACT_SECRETS", "").lower() == "true"
|
||||
_ENABLE_SECRET_REDACTION = os.getenv("LITELLM_DISABLE_REDACT_SECRETS", "").lower() != "true"
|
||||
|
||||
_REDACTED = "REDACTED"
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ SECRET = "sk-proj-abc123def456ghi789jklmnopqrst"
|
|||
|
||||
@pytest.fixture(autouse=True)
|
||||
def _enable_redaction():
|
||||
"""Enable secret redaction for all tests in this module."""
|
||||
"""Ensure secret redaction is on (the default) for all tests in this module."""
|
||||
with patch("litellm._logging._ENABLE_SECRET_REDACTION", True):
|
||||
yield
|
||||
|
||||
|
|
@ -133,7 +133,7 @@ def test_filter_redacts_extra_fields():
|
|||
|
||||
|
||||
def test_disable_redaction_passes_secrets_through():
|
||||
"""When _ENABLE_SECRET_REDACTION is False, secrets pass through."""
|
||||
"""When LITELLM_DISABLE_REDACT_SECRETS=true, secrets pass through."""
|
||||
with patch("litellm._logging._ENABLE_SECRET_REDACTION", False):
|
||||
record = logging.LogRecord(
|
||||
name="test",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue