security: enhance API key redaction with comprehensive testing and error handling

- Refactored redaction logic to use centralized helper function
- Added robust error handling in AccessLogFormatter
- Improved regex patterns for better OpenAI key detection
- Added comprehensive unit tests covering edge cases and error scenarios
- Enhanced input validation with descriptive error placeholders
This commit is contained in:
Shuai Lin
2025-07-21 10:40:24 +08:00
parent f3d9cb2b85
commit 9d4d6464bf
6 changed files with 216 additions and 27 deletions

1
tests/__init__.py Normal file
View File

@@ -0,0 +1 @@
# Tests package