-
Notifications
You must be signed in to change notification settings - Fork 2k
print sanitized api key to help troubleshoot #4764
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
Added API key sanitization in error messages to help with troubleshooting embedding errors while maintaining security.
- Modified
backend/model_server/encoders.py
to include sanitized API key (first 4 and last 4 chars visible) in embedding error messages - Ensures sensitive API key information is protected while providing enough context for debugging
- Consider adding a test case to verify the API key sanitization logic works as expected
1 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile
self.timeout = timeout | ||
self.http_client = httpx.AsyncClient(timeout=timeout) | ||
self._closed = False | ||
self.sanitized_api_key = api_key[:4] + "********" + api_key[-4:] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Consider moving API key sanitization to a separate utility function for reuse and consistent sanitization across the codebase
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks solid!
Co-authored-by: Richard Kuo (Onyx) <rkuo@onyx.app>
Co-authored-by: Richard Kuo (Onyx) <rkuo@onyx.app>
Co-authored-by: Richard Kuo (Onyx) <rkuo@onyx.app>
Co-authored-by: Richard Kuo (Onyx) <rkuo@onyx.app>
Description
Fixes https://linear.app/danswer/issue/DAN-2010/print-sanitized-api-key-in-embedding-exceptions-to-help
How Has This Been Tested?
[Describe the tests you ran to verify your changes]
Backporting (check the box to trigger backport action)
Note: You have to check that the action passes, otherwise resolve the conflicts manually and tag the patches.