You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@answer.apache.org by li...@apache.org on 2026/07/09 07:58:49 UTC

(answer-plugins) 08/12: fix(pgvector): avoid logging raw config and DSN credentials

This is an automated email from the ASF dual-hosted git repository.

LinkinStars pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/answer-plugins.git

commit ec7cda1140f1ee0c17e7cdb46056731ef139d8d5
Author: hgaol <dh...@hotmail.com>
AuthorDate: Wed Jul 8 14:05:56 2026 +0000

    fix(pgvector): avoid logging raw config and DSN credentials
    
    The debug logs printed the entire raw config payload (which can include
    the embedding API key) and the full PostgreSQL DSN (which can include
    username/password). Log the config size and whether a DSN is set instead.
---
 vector-search-pgvector/pgvector.go | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/vector-search-pgvector/pgvector.go b/vector-search-pgvector/pgvector.go
index dc50601..3b98bf6 100644
--- a/vector-search-pgvector/pgvector.go
+++ b/vector-search-pgvector/pgvector.go
@@ -275,7 +275,7 @@ func (e *VectorSearchEngine) ConfigFields() []plugin.ConfigField {
 
 // ConfigReceiver applies configuration from the admin UI.
 func (e *VectorSearchEngine) ConfigReceiver(config []byte) error {
-	log.Debugf("pgvector: ConfigReceiver called, raw config=%s", string(config))
+	log.Debugf("pgvector: ConfigReceiver called, config size=%d bytes", len(config))
 
 	// Pre-process: convert string numbers to actual numbers before unmarshalling,
 	// because the admin UI sends all form values as strings.
@@ -297,8 +297,8 @@ func (e *VectorSearchEngine) ConfigReceiver(config []byte) error {
 
 	e.Config = conf
 
-	log.Debugf("pgvector: config parsed: dsn=%s model=%s level=%s threshold=%.2f",
-		conf.DSN, conf.EmbeddingModel, conf.EmbeddingLevel, conf.SimilarityThreshold)
+	log.Debugf("pgvector: config parsed: dsn_set=%t model=%s level=%s threshold=%.2f",
+		conf.DSN != "", conf.EmbeddingModel, conf.EmbeddingLevel, conf.SimilarityThreshold)
 
 	if !plugin.StatusManager.IsEnabled("pgvector_search") {
 		log.Debugf("pgvector: plugin not active, skipping initialization")