From 24e34a4a8dd3c5ea47cd55b53444dcb5230ab873 Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Wed, 17 Jul 2024 14:02:19 +0100 Subject: [PATCH] Replaced API keys with last 4 characters for debugging purposes. --- aider/main.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/aider/main.py b/aider/main.py index a8c9de437..f47ed36cb 100644 --- a/aider/main.py +++ b/aider/main.py @@ -140,11 +140,13 @@ def format_settings(parser, args): def scrub_sensitive_info(args, text): - # Replace sensitive information with placeholder + # Replace sensitive information with last 4 characters if text and args.openai_api_key: - text = text.replace(args.openai_api_key, "***") + last_4 = args.openai_api_key[-4:] + text = text.replace(args.openai_api_key, f"...{last_4}") if text and args.anthropic_api_key: - text = text.replace(args.anthropic_api_key, "***") + last_4 = args.anthropic_api_key[-4:] + text = text.replace(args.anthropic_api_key, f"...{last_4}") return text