fix(providers): 连接 endpoint 持久化与回显前剥离 userinfo 凭证 - #94
Open
yjg-djb wants to merge 1 commit into
Open
Conversation
ProviderConfig 是非 secret 设置通道(凭证属于 OS 级 CredentialStore),setConfig 已做字段白名单,但 endpoint 字段本身 未做 secret 形态检查——URL userinfo(scheme://user:pass@host)是 常见凭证携带形态,会在 connections.json 明文落盘并回显到 UI (PR helsome#64 production canary 运行实测发现,见该 PR 证据评论)。 - 新增 sanitizeEndpoint:scheme://user:pass@host → scheme://[REDACTED]@host,协议/主机/路径保留,目标地址仍可读; 无 userinfo 的 endpoint 原样通过 - setConfig 持久化前净化(写侧) - getConfig 惰性净化(读侧),修复存量明文文件,不破坏本地优先 的无迁移语义 - 单测覆盖:userinfo 密码剥离且落盘无明文、旧文件读侧净化、 无 userinfo endpoint 行为不变 Closes helsome#93
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.
Summary
修复 #93:连接 endpoint 在持久化与回显前剥离 URL userinfo 凭证(
scheme://user:pass@host→scheme://[REDACTED]@host)。问题回顾
ProviderConfig是非 secret 设置通道(接口注释明确 "Credentials belong in the OS-backed CredentialStore"),setConfig已做字段白名单防 apiKey 落盘,但 endpoint 字段本身未做 secret 形态检查。PR #64 的 production canary 运行实测:经真实 IPC 写入带 userinfo 的 endpoint 后,connections.json明文保存了folio_user:CANARYLEAK04dbpass,并会经 connection health 链路回显。修复(2 个文件,+69 行)
sanitizeEndpoint(endpoint):仅剥 userinfo,协议/主机/路径保留(目标地址仍可读);无 userinfo 的 endpoint 逐字不变ConnectionStore.setConfig持久化前净化getConfig惰性净化——存量明文文件无需迁移即不再暴露(符合本地优先的无迁移语义)redactText已覆盖的 secret 形态);因该模块尚未合入 main,此处为独立最小实现,feat(privacy): unify redaction and data minimization behind one rule source #64 合并后可统一规则源测试
按 #93 验收标准新增 3 个用例 + 全部既有测试不变:
connections.json无明文密码/用户名,含[REDACTED],主机路径保留getConfig返回https://[REDACTED]@db.host.internal:5432/apihttps://user:legacy-pass@…→https://[REDACTED]@…https://api.example.com/v1?symbol=AAPL逐字不变测试报告
bun run typecheck;bun test --isolate;bun test packages/shared/src/providers4cdb6bdbun test --isolate0 fail(1361 tests / 152 files,8 skip 为基线既有);providers 套件 112 tests / 0 failCloses #93