Agent pool Postgres DSN is logged in cleartext, including the password, while the auth DSN is redacted
维护者通常 1 天内回复
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 75/100
调研方向
找出 agent pool 的 PostgreSQL collection log 路径,并将其与已经对其 DSN 进行 redaction 的 auth database logging 路径进行比较。使用 PostgreSQL agent-pool DSN 重现该问题,将现有的 redaction 方法应用于记录的值,并验证 password 不再出现在 collection log 中。
由索引模型根据 Issue 内容生成。
描述
LocalAI version
v4.9.0 (localai/localai:latest-gpu-nvidia-cuda-12, revision f7ad3f70eb5d8a0ddf80e08557f0d7df28cf032e)
Describe the bug
When the agent pool uses the Postgres vector engine, LocalAI logs the full
LOCALAI_AGENT_POOL_DATABASE_URL at INFO level, including the database
password in cleartext, every time it opens a collection.
The auth database URL is redacted correctly in the same log stream, so the
redaction helper already exists. It just is not applied on this path.
Redacted (correct), from LOCALAI_AUTH_DATABASE_URL:
INFO Auth enabled database="postgresql://%2A%2A%2A:%2A%2A%2A@postgres:5432/localai_auth?sslmode=disable"
Not redacted, from LOCALAI_AGENT_POOL_DATABASE_URL (password replaced by hand
before pasting here):
INFO PostgreSQL collection collectionName="AML" databaseURL="postgresql://localai_user:REDACTED-PASSWORD@postgres:5432/localai?sslmode=disable"
One line is emitted per collection on every start, so the credential is
repeated and persists in whatever collects container logs. In a Docker
deployment these sit on disk under the json-file driver and are readable by
anyone who can read container logs, for example through a management UI,
without any access to the environment or the compose file.
To Reproduce
- Set
LOCALAI_AGENT_POOL_VECTOR_ENGINE=postgresand
LOCALAI_AGENT_POOL_DATABASE_URL=postgresql://user:password@host:5432/db?sslmode=disable - Have at least one agent collection defined.
- Start LocalAI and read the log.
The PostgreSQL collection line contains the password verbatim.
Expected behavior
The agent pool DSN should be redacted in logs the same way the auth DSN
already is, or the log line should print only the host, port and database
name rather than the whole URL.
Additional context
Not configurable from the outside: the value has to be a DSN, so there is no
way for an operator to avoid this short of not using the Postgres vector
engine. Rotating the password does not help, because the new one is logged
too.
Suggested fix: apply the same redaction used for the auth DSN to the agent
pool DSN before logging.
- 主要语言
- Go
- 星标
- 49.5k
- 派生
- 4.5k
- 平均合并
- 23 小时 15 分钟
- 30 天内合并 PR
- 382
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
mudler/LocalAI 的其他 Issue
-
bug unconfirmed
难度 2/5 1-3 小时 新手友好度 67/100
维护者通常 1 天内回复
-
Open Responses API doesn't accept "output_text" as an input Item可能已有人在做 @localai-org-maint-bot 于 19 天前认领。 未关闭bug unconfirmed
难度 2/5 1-3 小时 新手友好度 78/100
mudler/LocalAI#12337 · 1 条评论 ·
维护者通常 1 天内回复
-
Gallery model audio-cpp-sortformer-diarization fails to install: SHA mismatch, reproducible across retries可能重新可做 关联的 PR 已关闭且未合并。 未关闭
难度 2/5 1-3 小时 新手友好度 76/100
mudler/LocalAI#11995 · 1 条评论 ·
维护者通常 1 天内回复
-
fish-speech: make compile:true usable on Blackwell sm_121 by honouring the CUDA toolkit's ptxas可能重新可做 关联的 PR 已关闭且未合并。 未关闭enhancement
难度 2/5 1-3 小时 新手友好度 76/100
mudler/LocalAI#11348 · 1 条评论 ·
维护者通常 1 天内回复
-
bug unconfirmed
难度 4/5 3-5 天 新手友好度 32/100
维护者通常 1 天内回复
相似的 Issue
-
effort:high model:sonnet phase:3 type:docs
难度 2/5 1-3 小时 新手友好度 68/100
-
难度 2/5 1-3 小时 新手友好度 72/100
OffchainLabs/nitro#4771 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 65/100
BurntSushi/toml#530 ·
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 7 天内回复