Repository navigation
[PR] fix(log): mask userinfo in non-http scheme URLs in logs/diagnostics/publish (#4191) - #4402
ranxianglei wants to merge 2 commits into
Conversation
…ublish (#4191) maskUrlsInText / maskUrlsForPublish / maskUrlsForDiagnostics all shared one entry regex that only matched https?://, so socks5://user:pass@host (self-relay forwarding addresses), ws/wss, ftp etc. carried their inline credentials verbatim into logs, diagnostic blobs and public publish text. The single-URL maskers already strip userinfo/query/hash via new URL for every scheme; only the entry find-regex was too narrow. Shared const EMBEDDED_URL_RE now matches any RFC-3986 scheme://… form in all three fns. No leading word-boundary on purpose: a word-char-glued URL (xhttps://…) must stay masked exactly as before - over-matching is safe, under-matching leaks. 3 regression tests added. Behavior change: non-http scheme URLs are now host-masked where they were previously passed through.
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.5240-pr.4402.c9d72baThis exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr4402.tgz
npm install -g packageInstall instructions are refreshed on each push. |
(ai: vllm-qwen/qwen3.8-27b) 查重:不重复。#4402 是仓库内唯一 open 的、针对源 issue #4191(日志脱敏漏非-http 协议 URL 的 userinfo)的修复 PR。相关历史项均为已关闭的不同机制,不同源:#3832(诊断 blob 掩码私有中继主机)、#1718/#1719(凭据形状扫描)、#2570(usage-vs-est 诊断绕过掩码)——都不涉及本次「入口 find-regex 只认 标签: 这是 [PR] 镜像,分支 接下来我给八问结论,并顺手补一条 |
…-http schemes (#4191) Adds the one surface the original three #4191 test blocks did not cover directly: maskUrlsForPublish. It uses different always-mask logic (isPublicApiHost, ignoring BILI_LOG_MASK_HOSTS=0), so it is pinned separately rather than relying on transitive coverage via maskUrlsInText/maskUrlsForDiagnostics.
(ai: vllm-qwen/qwen3.8-27b) 独立审核完成(自行读 diff、逐条判回归,未照抄 issue 结论)。结论:可合 —— 修复正确、测试有牙、前一 head CI 已绿;并顺手补了一条原本缺失的 publish 面回归测试(独立 commit 结构化八问
我独立验证了什么(不复述 issue)
顺手小修(独立标注 commit)
行为变更披露(按政策必报)
CI前 head 判定:可合。 代码正确、diff 干净(每行都服务于 #4191)、引用源 issue、无 kernel/config/version/wire 变更。待 |
What & why
maskUrlsInText,maskUrlsForPublish,maskUrlsForDiagnosticsinsrc/log-mask.tsall shared one entry regex that only matchedhttps?://. Any other scheme carrying inline credentials —socks5://user:pass@host(self-relay forwarding addresses),ws/wss,ftp, … — passed through verbatim into logs, diagnostic blobs, and public publish text. The single-URL maskers (maskUrlForLogetc.) already strip userinfo/query/hash vianew URLfor every scheme; only the entry find-regex was too narrow, so the leak was purely an entry-gate gap.Fix
One shared const now drives all three fns:
matching any RFC-3986
scheme://…form. Extracted as a single constant (was triplicated inline) so the three surfaces can't drift apart again.Deliberate deviation from the suggested fix
The issue proposed
\b[a-z][a-z0-9+.-]*:\/\/…. I dropped the leading\b: a word-char-glued URL likexhttps://foo.com/barmust stay masked exactly as before — with\b,_/hare both word chars so no boundary forms and the match is lost → leak. Without it, coverage is a strict superset of the old pattern (over-matching a rareword://tokenis safe; under-matching leaks). Pinned by a regression test.Behavior change (flagged per policy)
maskUrlForDiagnosticsis unchanged and remains per-scheme (a localws://127.0.0.1:…/acpstays verbatim by design).No config/env/version surface touched (pure internal regex behavior).
Tests
3 new regression tests in
tests/log-mask.test.ts(socks5/ws/wss/ftp userinfo stripped; pathless non-special scheme keeps no trailing slash; word-char-glued URL still masked; diagnostics loopback-per-scheme preserved). Local targeted run:tests/log-mask.test.ts24/24 green;npm run typecheckclean. Full-suite verdict = remote CI on this head.Closes #4191