- Notifications
You must be signed in to change notification settings - Fork20.1k
fix: Secure API key representation in __repr__ method to prevent cred…#34365
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:master
Are you sure you want to change the base?
Conversation
liu-jin-yi commentedDec 15, 2025
fix#34356 |
codspeed-hqbot commentedDec 15, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
CodSpeed Performance ReportMerging#34365 willnot alter performanceComparing Summary
Footnotes
|
a6a4217 toc44fddbCompare…ential leakage- Added custom __repr__ methods to ChatOpenAI, BaseOpenAI, and OpenAIEmbeddings classes- API keys are now redacted showing only first 3 and last 4 characters (e.g., 'sk-...wxyz')- Short keys (< 8 chars) are completely masked with '***'- Callable API key providers are also properly masked- Added comprehensive unit tests to verify the fixFixeslangchain-ai#34356
c44fddb to6a20474Compare
…ential leakage
Fixes#34356
(Replace this entire block of text)
Read the full contributing guidelines:https://docs.langchain.com/oss/python/contributing/overview
Thank you for contributing to LangChain! Follow these steps to have your pull request considered as ready for review.
make format,make lintandmake testfrom the root of the package(s) you've modified.Additional guidelines:
uv.lockfiles unless or add dependencies topyproject.tomlfiles (even optional ones) unless you have explicit permission to do so by a maintainer.