fix: redact credentials in client config log output - #833
Open
yuhi-sa wants to merge 1 commit into
Open
Conversation
Client constructors log db_config / connect_config verbatim, which writes plaintext passwords (e.g. opensearch http_auth tuples) to the console and the rotating log file. Mask them with a shared redact_sensitive() helper, and reuse it for the existing result-file redaction in models.py. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: yuhi-sa The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Author
|
/assign @XuanYang-cn |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Many client constructors log the connection config verbatim, e.g.:
DBConfig.to_dict()has to hand the driver its plaintext credentials, so even though configs store passwords as pydanticSecretStr, the dict that gets logged contains them in plaintext:This goes to both the console and the rotating log file (
RotatingFileHandler, 10MB x 5 backups), so real database passwords persist on disk and leak into anything that collects logs (CI output, shared benchmark reports, support bundles).The same pattern exists in 16 client files (23 log sites): aws_opensearch, oss_opensearch, aliyun_opensearch, lindorm, hologres, memorydb, pgvector, pgvectorscale, pgvecto_rs, pgdiskann, alloydb, vectorchord, adbpg, cockroachdb, oceanbase, seekdb.
Fix
redact_sensitive()helper invectordb_bench/backend/utils.pythat recursively masks credential values:password/api_key/token(the same keys the existing result-file redaction masks)http_authentries:(user, secret)pairs keep the user and mask the secret; opaque auth objects (e.g.AWS4Authused by OpenSearch Serverless) are masked entirely{self.db_config}becomes{redact_sensitive(self.db_config)}models.py(TestResult._redact_sensitive_fieldswas a duplicate of the same logic, introduced in feat: Add VectorDBBench Cloud Leaderboard benchmark cases and client support #775), removing the duplicationAfter the fix:
Notes
http_auth, which never appears in result files.self.db_config['database']) and are left as-is.to_dict()'s contract or adding a global logging filter, to keep the diff easy to audit. Happy to centralize it (e.g. a redacted repr onDBConfig) as a follow-up if you'd prefer.Tests
redact_sensitive()intests/test_utils.py(sensitive keys, http_auth pair / opaque object, nested structures).make lintpasses and all 27 tests intests/test_utils.pypass locally.