Skip to content

Commit bc65a7e

Browse files
committed
bump to v1.1.0: sanitize API key leakage in error logs
- redact API key, token hash from error messages - show clear "authentication failed" hint on 401 errors Made-with: Cursor
1 parent f26c831 commit bc65a7e

3 files changed

Lines changed: 16 additions & 3 deletions

File tree

codet/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@
1111
- Code hotspot analysis to identify frequently modified areas.
1212
"""
1313

14-
__version__ = "1.0.9"
14+
__version__ = "1.1.0"

codet/codet.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,20 @@ def ai_analysis(self, text_input):
475475
print(full_reply)
476476
return full_reply
477477
except Exception as e:
478-
self.logger.error(f"AI API call failed ({base_url}): {e}")
478+
import re
479+
sanitized = re.sub(
480+
r'(API Key|Key Hash|Token|api_key|Bearer)\s*[=:]\s*\S+',
481+
r'\1=***',
482+
str(e)
483+
)
484+
error_str = str(e).lower()
485+
if '401' in error_str or 'auth' in error_str:
486+
self.logger.error(
487+
f"AI authentication failed ({base_url}). "
488+
"Check your --api-token (-to) value."
489+
)
490+
else:
491+
self.logger.error(f"AI API call failed ({base_url}): {sanitized}")
479492
return None
480493

481494

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setup(
77
name="codet",
8-
version="1.0.9",
8+
version="1.1.0",
99
author="clemente0620",
1010
author_email="",
1111
description="A cross-platform command-line tool for file processing and Git repository analysis with support for commit history tracking, code hotspot detection, and customizable filtering options",

0 commit comments

Comments
 (0)