From b32ac1c8dda49d0d49805db404795bf559f20c30 Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Thu, 29 Oct 2026 00:47:34 +0000 Subject: [PATCH] fix(spend-logs): mask Linear API keys in spend logs Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- litellm/litellm_core_utils/secret_redaction.py | 1 + tests/unit/proxy/spend_tracking/test_spend_tracking_utils.py | 1 + 2 files changed, 2 insertions(+) diff --git a/litellm/litellm_core_utils/secret_redaction.py b/litellm/litellm_core_utils/secret_redaction.py index 15026d8b5cc..0ca9d6802f7 100644 --- a/litellm/litellm_core_utils/secret_redaction.py +++ b/litellm/litellm_core_utils/secret_redaction.py @@ -112,6 +112,7 @@ _TOKEN_SHAPES: Final = ( r"(?:ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9]{36,}", r"github_pat_[A-Za-z0-9_]{82}", r"glpat-[A-Za-z0-9\-_]{20,}", + r"lin_api_[A-Za-z0-9]{40}\b", r"xox[abposr]-[A-Za-z0-9-]{10,}", r"hf_[A-Za-z0-9]{34,}", r"npm_[A-Za-z0-9]{36}\b", diff --git a/tests/unit/proxy/spend_tracking/test_spend_tracking_utils.py b/tests/unit/proxy/spend_tracking/test_spend_tracking_utils.py index 927998cd980..66e1f08eed1 100644 --- a/tests/unit/proxy/spend_tracking/test_spend_tracking_utils.py +++ b/tests/unit/proxy/spend_tracking/test_spend_tracking_utils.py @@ -1382,6 +1382,7 @@ _TOKEN_SHAPED_SECRETS: Final = ( "AKIAIOSFODNN7EXAMPLE", "xoxb-1234567890-0987654321-AbCdEfGhIjKl", "glpat-AbCdEfGhIj1234567890", + "lin_api_" + "AbCdEfGhIj" * 4, "hf_" + "AbCdEfGhIj" * 3 + "KlMn", "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxMjM0NTY3ODkwIn0.dozjgNryP4J3jVmNHl0w5N_XgL0n3I9PlFUP0THsR8U", "-----BEGIN RSA PRIVATE KEY-----\nMIIEpAIBAAKCAQEA\n-----END RSA PRIVATE KEY-----",