Repository navigation
Sanitize stored log data / 清理存储的日志数据 - #1760
Merged
Merged
Conversation
Redact IP addresses, Oracle VCN domains and credentials from server-log text and chart-series endpoint identifiers at ingest, in the public-database copy, and in a dry-run-by-default backfill for stored rows. Tags are HMACs under a per-process random key, so distinct endpoints stay distinct and nothing is reversible. The rules and test vectors match InferenceX's artifact redactor. Drop the database hostname from the agentx-integrity manifest, which was uploaded as a public artifact, and stop printing database hosts in the ingest and recompute workflows. 中文:入库时、复制到公开数据库时,以及通过默认试运行的回填脚本,对服务日志文本和 chart series 端点标识中的 IP 地址、Oracle VCN 域名和凭据进行脱敏。标签为使用每个进程 随机密钥计算的 HMAC,不同端点仍可区分且无法反推。规则和测试向量与 InferenceX 的产物 脱敏工具一致。从作为公开产物上传的 agentx-integrity manifest 中移除数据库主机名,并且 ingest 和 recompute workflow 不再打印数据库主机名。
6 of 11 tasks
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
中文:整理日志清理相关文档和测试数据
# Conflicts: # packages/app/src/lib/api/api-route-catalog.ts
中文:将日志清理扩展到推广的运行
中文:加固日志清理
Takes main's oxfmt switch, which deletes .prettierignore, and main's real-driver PGlite harness (pgliteDriverSql) in test-pglite.ts. The row-insert shim this branch added to the old fake client is no longer needed. The tests that used it move to the real driver in the next commit. 合并 origin/main:采用 main 的 oxfmt 配置(删除 .prettierignore)以及 test-pglite.ts 中基于真实驱动的 PGlite 测试工具(pgliteDriverSql),本分支 为旧的模拟客户端添加的批量插入补丁已不再需要,相关测试在下一个提交中迁移到 真实驱动。
- Redact JWTs, as an HF Xet access token leaked in a stored header dump. - Keep pip's '(9.19.0.56)' installed-version suffix, which was redacted as an IP. - Add both as shared vectors, with a parenthesised public IP and mq_connect_ip still redacted. - Move the backfill loop into backfillLogRedaction so a PGlite test runs it twice on the real driver: dry run writes nothing, rows other than log text stay, and the second run is a no-op. - Port the redaction tests to bun:test and pgliteDriverSql, and test that ingest stores sanitized text and blocks. - Keep the shared vectors out of oxfmt and document what is kept and when the backfill runs. 捕获 JWT(存储的请求头中泄露了 HF Xet 访问令牌),保留 pip 输出中 "(9.19.0.56)" 形式的已安装版本号, 并将两者加入共享测试向量。将回填循环提取为 backfillLogRedaction,在真实驱动上用 PGlite 连续运行两次: 试运行不写入,日志以外的数据保持不变,第二次运行没有任何改动。脱敏相关测试迁移到 bun:test 与 pgliteDriverSql,并新增摄取写入已脱敏文本和数据块的测试。文档说明了保留的内容以及回填的运行时机。
- Replace email addresses with ***REDACTED***, after URL passwords. A real employee address appeared inside /home/<email>/.cache paths in 3 sampled points. - Keep what only looks like an email: user@host without a letters-only TLD, URL userinfo right after ://, scp-style remotes ([email protected]:org/repo), [email protected], @scope/pkg, image digests and decorators. The domain may not continue past a match, so a host is never cut short. - Flip the shared 'compact json url next to an email kept' case (renamed without 'kept') and add cases for each kept shape. InferenceX#5013 has to take the same file and rule. 清理存储日志中的邮箱地址(替换为 ***REDACTED***,在 URL 密码之后处理)。抽样中有 3 个数据点的 /home/<邮箱>/.cache 路径包含一位员工的邮箱。形似邮箱的内容保持不变:没有纯字母顶级域名的 user@host、 紧跟 :// 的 URL 用户信息、[email protected]:org/repo 形式的远程地址、[email protected]、@scope/pkg、镜像摘要和 装饰器。共享用例 "compact json url next to an email kept" 改为清理邮箱并去掉 kept,同时为每种保留形式 新增用例,InferenceX#5013 需同步更新。
- Tokens, IPs and emails right after an ANSI SGR code (\x1b[0m ends in a word character) or an escaped \n, \r or \t were skipped. Treat those as boundaries. - Redact Authorization Bearer/Basic/Token values, long bare Bearer tokens, upper-case *_TOKEN, *_API_KEY, *_SECRET, *_ACCESS_KEY and *_PASSWORD assignments with a non-placeholder value, nvapi- and ASIA keys, URL passwords under any scheme case and with JSON-escaped :\/\/. - Keep emails with internal TLDs (.internal, .local, .lan), [email protected](...) and the version column of pip list, conda list and torch's [conda] dump. - Bound the scheme and host-label repeats and the line look-back, so long dotted runs and huge single lines stay linear (100 MB: 45 s or more before, about 1 s after). - Add shared vectors for each, including non-ASCII text next to an IP and a token. 紧跟在 ANSI 颜色码(\x1b[0m 以单词字符结尾)或转义的 \n、\r、\t 之后的令牌、IP 和邮箱此前会被漏掉,现在视为 边界。新增清理 Authorization 的 Bearer/Basic/Token 值、较长的独立 Bearer 令牌、值不是占位符的大写 *_TOKEN、*_API_KEY、*_SECRET、*_ACCESS_KEY、*_PASSWORD 赋值、nvapi- 与 ASIA 密钥,以及任意大小写协议 和 JSON 转义 :\/\/ 形式的 URL 密码。保留内部顶级域名的邮箱、[email protected](...) 以及 pip list、conda list 和 torch [conda] 输出中的版本列。限制协议、主机标签和回看行首的长度,使长点分串和超长单行保持线性耗时。 为以上每项新增共享测试向量,包括与 IP 和令牌相邻的非 ASCII 文本。
…eads - Only a letter or digit now continues a private repository name, so name-server-1, name_default and name-tools lose it, and owner%2Fname and the name with - and _ swapped match. - Read repository visibility with GITHUB_TOKEN when it is set; the anonymous limit is 60 an hour. 私有仓库名只有在后面紧跟字母或数字时才保留,因此 name-server-1、name_default、name-tools 中的仓库名都会被 清理,owner%2Fname 以及 - 与 _ 互换的写法也会匹配。设置了 GITHUB_TOKEN 时,仓库可见性查询使用该令牌(匿名 调用每小时仅 60 次)。
- computeChartSeries groups sources by their raw identity, then serves endpointUrl, the source id and endpoint-based engine labels through redactText. Ids that then collide get #2, #3. - CHART_SERIES_VERSION stays at 21: read-only, all 776 endpoint URLs in production's 6,002 chart_series rows (535 with sources) are private, so a recompute would change nothing. - Document it on /api/v1/trace-server-metrics and update the reviewed source digest. computeChartSeries 先按原始标识对来源分组,再用 redactText 清理对外提供的 endpointUrl、来源 ID 以及基于端点的 引擎标签,清理后重复的 ID 加上 #2、#3。CHART_SERIES_VERSION 保持 21:只读检查显示生产环境 6,002 行 chart_series(535 行含来源)中的 776 个端点 URL 全部是私有地址,重新计算不会有任何变化。同时更新 /api/v1/trace-server-metrics 文档和已审核的源文件摘要。
- Snapshots store a SHA-256 of the database host instead of the host, and --verify refuses a manifest from another database, or one without a fingerprint. 快照记录数据库主机名的 SHA-256 而不是主机名本身,--verify 会拒绝来自其他数据库或缺少指纹的清单。
- Take a per-file advisory lock in the backfill and in compact-server-logs (now through compactStoredServerLogFile), and rebuild blocks whose char_count no longer matches already-sanitized text, which a racing compaction could have built from the raw text. - Append every html_url about to be cleared to an operator-only JSONL file (--url-map, default ~/.inferencex/redacted-run-urls/, mode 600), in the backfill and in sync-public-db, and print only its path. - backfill-server-log-files, backfill-gpu-metrics and backfill-runtime-metadata report and skip a run without html_url instead of querying INGEST_REPO. - Add --downstream: shared rules only, keeping a downstream database's private repository names and run URLs, without GitHub calls. 回填与 compact-server-logs(改为通过 compactStoredServerLogFile)对每个日志文件加同一把 advisory 锁;对已清理 文本但 char_count 不一致的数据块(可能由并发压缩根据原始文本生成)重新生成。在回填和 sync-public-db 清空 html_url 之前,把原 URL 追加到仅操作者可读的 JSONL 文件(--url-map,默认 ~/.inferencex/redacted-run-urls/, 权限 600),只打印文件路径。backfill-server-log-files、backfill-gpu-metrics、backfill-runtime-metadata 遇到 没有 html_url 的运行时报告并跳过,不再改用 INGEST_REPO。新增 --downstream:只应用通用规则,保留下游数据库 自己的私有仓库名和运行 URL,也不调用 GitHub。
- List every rule and what stays, the trace-metric sanitization, the URL map, --downstream, the s-maxage=31536000 log cache, downstream purges and backfills, and Neon branches and PITR. 文档列出全部清理规则和保留内容、跟踪指标的脱敏、URL 映射文件、--downstream、日志缓存的 s-maxage=31536000、下游部署各自的缓存清除与回填,以及 Neon 分支和时间点恢复中保留的原始文本。
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit b6834c9. Configure here.
- Treat any ANSI CSI ending in a letter (\x1b[2K, \x1b[1A, not just colour codes) and the escaped spellings \x1b[, \u001b[ and \033[ as token boundaries. - Redact JSON-escaped secret assignments (\"MY_SECRET_TOKEN\":\"...\"), lower-case *_token, *api_key, *_secret and *_password keys and --*-token/--api-key style flags when the value mixes letters and digits. Match those keys from the key word with a lookbehind, which also makes URL passwords cheaper; skip the email scan unless an @ is followed by a dotted domain. - Keep a pip/conda version column only when the package name has a lower-case letter and no address-like word, so MASTER_ADDR, mq_connect_ip and node-a lines with public IPs are redacted. - Keep a bare Bearer followed by a slash path without digits (bearer src/auth/...). - 12 new shared vectors and one changed: the placeholder case now ends hf_token=None. 任何以字母结尾的 ANSI CSI 序列(\x1b[2K、\x1b[1A,不只是颜色码)以及转义写法 \x1b[、\u001b[、\033[ 现在都视为 边界。新增清理 JSON 转义引号的密钥赋值、小写的 *_token、*api_key、*_secret、*_password 键以及 --*-token、 --api-key 等命令行参数(值须同时含字母和数字);这些键改为从关键词开始匹配并用后行断言校验,URL 密码同样 如此,邮箱扫描仅在 @ 后跟带点的域名时运行,以保持性能。pip/conda 版本列只有在包名含小写字母且不含地址类 词语时才保留,因此 MASTER_ADDR、mq_connect_ip、node-a 等行中的公网 IP 会被清理。独立的 Bearer 后跟不含 数字的斜杠路径时保留。新增 12 个共享用例,并修改占位符用例,改为以 hf_token=None 结尾。
- Hash hostname plus pathname, so two databases on one host no longer share a fingerprint. 清单指纹改为对主机名加路径(数据库名)取哈希,同一主机上的两个数据库不再共用指纹。
- backfill-log-redaction exits 1 whenever a file failed, --downstream included, through the new reportLogRedaction. - For already-sanitized text holding ***REDACTED***, decode the blocks and rebuild them when they differ, which catches raw blocks whose replacements kept the same length. - chmod the URL map to 600 after every append, even when it already existed. - Admin backfills read every URL map in ~/.inferencex/redacted-run-urls/ and use a cleared run's recorded repository; other runs without html_url fall back to INGEST_REPO again. No migration. backfill-log-redaction 只要有文件失败就以 1 退出(包括 --downstream),由新的 reportLogRedaction 统一处理。 对已清理且含 ***REDACTED*** 的文本,解码数据块并在不一致时重建,以发现替换前后长度相同的原始数据块。 每次追加后都把 URL 映射文件权限设为 600,即使文件已存在。管理类回填会读取 ~/.inferencex/redacted-run-urls/ 下的全部映射文件,对被清空 URL 的运行使用记录的仓库;其他没有 html_url 的运行重新回退到 INGEST_REPO。无需数据库迁移。
- Describe CSI and escaped boundaries, lower-case and flag secrets, the package-row and Bearer limits, the decoded-block check, the exit code and how admin backfills use the URL maps. 文档补充 CSI 与转义边界、小写键和命令行参数中的密钥、包版本行与 Bearer 的限制、数据块解码校验、 退出码,以及管理类回填如何使用 URL 映射文件。
This comment has been minimized.
This comment has been minimized.
1 of 4 tasks
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Nov 25, 2026
zbpatel
pushed a commit
to zbpatel/InferenceX-app
that referenced
this pull request
Nov 25, 2026
…例暂不响应点击 (SemiAnalysisAI#1859) * fix(inference): keep a legend pick made while a model pick is still rendering The model, sequence and precision selectors show a pick at once and render the chart for it as a React transition. Until that transition lands, the legend still shows the old scope, and a click there commits before the pick. When the pick lands, InferenceProvider resets the hardware to the new scope's defaults and the click is lost. This made agentic-detail-back-nav.cy.ts flaky, failing in soloLegendSeries with "Found '3', expected '1'" in the SemiAnalysisAI#1848 merge queue and on SemiAnalysisAI#1760. With 20x CPU throttling the spec's steps fail on every run. InferenceProvider now holds a scope pick until its hardware reset runs, together with any hardware the reader picks from the legend in between. The reset keeps that choice, limited to hardware the new scope has. A legend pick made before the scope pick still gives way to the new defaults. The spec also waited only for the selector label, so later steps could click a point on the old model's chart. selectTargetModel now waits for inference-page-heading, which renders from the committed model. 模型、序列长度和精度选择器会立即显示新的选项,再以 React transition 渲染对应的图表。在 transition 完成之前,图例仍然显示旧的筛选范围,这时在图例上的点击会先于切换生效。切换完成后,InferenceProvider 会把硬件重置为新范围的默认值,这次点击就被丢弃了。agentic-detail-back-nav.cy.ts 因此间歇失败,soloLegendSeries 报错 "Found '3', expected '1'",SemiAnalysisAI#1848 的 merge queue 和 SemiAnalysisAI#1760 都出现过。在 20 倍 CPU 节流下,这组测试步骤每次都会失败。 现在 InferenceProvider 会保留尚未执行硬件重置的范围切换,并记下读者在此期间从图例中选择的硬件。重置时保留这一选择,只去掉新范围中没有的硬件。在切换之前做出的图例选择仍会让位于新范围的默认值。 此外,测试之前只等待选择器标签更新,后续步骤可能点到旧模型图表上的数据点。selectTargetModel 现在改为等待 inference-page-heading,它根据已提交的模型渲染。 * fix(inference): give a new scope its defaults when a pending legend pick does not carry over When a legend pick made during a pending model, sequence or precision pick shares no hardware with the new scope, the reset fell through to the defaults path. The click had already set bestPerSku to false and hardwareDefaultsOverridden to true, so the new scope selected every chip instead of its defaults. For Qwen 3.5 that kept H200 on, which its defaults leave off. Each scope pick now records the best-per-SKU choice and defaults flag it leaves. When the reader's legend pick does not carry over, the reset restores those flags and computes the defaults from them. A new test picks Qwen 3.5 and solos B200, which Qwen lacks, before the pick lands. It fails without this change. 当模型、序列长度或精度切换尚未完成时,读者在图例中做出的选择如果与新范围没有任何共同硬件,重置会走默认值分支。但这次点击已经把 bestPerSku 设为 false、把 hardwareDefaultsOverridden 设为 true,新范围因此会选中全部芯片,而不是它的默认硬件。以 Qwen 3.5 为例,默认应关闭的 H200 会保持开启。 现在每次范围切换都会记下它设定的 best-per-SKU 选择和默认值标记。读者的图例选择无法保留时,重置会恢复这两个值,并据此计算默认硬件。新增测试在 Qwen 3.5 切换完成前单独选择 Qwen 没有的 B200,未修复时该测试失败。 * fix(inference): keep a pending model pick's reset flags when a precision or sequence pick follows A sequence or precision pick made while a model pick was still rendering overwrote the pending scope pick with the best-per-SKU choice and defaults flag from its own render, which predates the model pick. If a legend click then picked only hardware the new model lacks, the reset restored those stale flags. A reader who had set best per SKU before switching models got every chip of the new model instead of its defaults. Sequence and precision picks now keep the flags of a pick that is still pending and only clear its legend hardware. A new test sets best per SKU, then picks Qwen 3.5 and FP8 and solos B200 before either lands. It ends on Qwen 3.5's defaults and fails without this change. 模型切换尚未完成时,如果又切换了序列长度或精度,后者会用自身渲染时的 best-per-SKU 选择和默认值标记覆盖待处理的范围切换,而这些值早于模型切换。随后若读者在图例中只选择了新模型没有的硬件,重置就会恢复这些过时的标记。读者如果在切换模型前设置过 best per SKU,新模型就会选中全部芯片,而不是它的默认硬件。 现在序列长度和精度切换会保留仍在等待中的切换所记录的标记,只清除其中的图例硬件选择。新增测试先设置 best per SKU,再在切换完成前选择 Qwen 3.5 和 FP8 并单独选择 B200,最终应得到 Qwen 3.5 的默认硬件,未修复时该测试失败。 * fix(inference): make hardware actions inert while a scope pick is still rendering Replace the record-and-replay handling of legend clicks made during a pending model, sequence or precision pick. Bugbot found five problems in it, all in how the recorded pick was merged, restored or cleared. InferenceProvider now exposes scopePickPending from useInferenceFilters. It is useOptimistic state set inside the pick's transition, so React clears it when that transition ends, including a pick that ends on the scope already shown. While it is true, legend toggle, remove, select all and best per SKU do nothing, and a ?preset= link waits. The inference, power timeline and historical trends legends render aria-busy and inert with no layout change. A click in that brief window now does nothing, instead of being applied and then undone. The pending-pick tests now check that actions made while a model pick is pending are ignored and the new model opens on its defaults, that the flag clears after a no-op or reverted pick, and that best per SKU and presets still apply once nothing is pending. The video history source pin is updated for the new filters field, which feeds no recorded entry. 用新的方式取代此前对切换期间图例点击的记录并重放逻辑。Bugbot 在这套逻辑中发现了五个问题,都出在记录的切换如何合并、恢复或清除上。 现在 InferenceProvider 通过 useInferenceFilters 提供 scopePickPending。它是在切换的 transition 中设置的 useOptimistic 状态,transition 结束时由 React 自动清除,即使切换最终停留在当前范围也一样。该值为 true 时,图例的单选、移除、全选和 best per SKU 都不会执行,?preset= 链接会等待。推理图表、功耗时间线和历史趋势的图例会带上 aria-busy 和 inert,布局不变。在这段短暂时间里点击图例不会有任何效果,而不是先生效再被撤销。 pending-pick 测试现在检查模型切换尚未完成时的操作会被忽略、新模型以默认硬件打开,检查无效切换或被撤回的切换之后标记会被清除,并检查没有待完成的切换时 best per SKU 和预设照常生效。视频历史的源文件哈希随新的 filters 字段更新,该字段不影响任何已记录的条目。
This branch was successfully deployed
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
CI server logs are stored in the database and served to anyone through
/api/v1/server-log,/api/v1/server-log-searchand the log viewer. Until now they were stored exactly as the runners wrote them. A read-only sample of production found several things the public API serves today:mq_connect_ip=107.191.51.58andtcp://104.207.139.45:48977;This PR sanitizes log text in three places.
benchmark-ingest.tsruns every stored file (primary, child rows and their blocks) throughetl/log-redaction.tsbefore writing.sync-public-dbdoes the same. For runs from a repository that is not public, it also removes the repository name and stores the run withouthtml_url.bun run admin:db:backfill-log-redactionrewrites them. The read routes do not sanitize at read time, so every row stored before this PR stays exposed until the backfill runs with--writeand the log cache is purged.Trace-replay server metrics (
/api/v1/trace-server-metricsand/api/v1/trace-server-metric-source) now apply the same rules to source endpoint URLs, source ids and engine labels when the chart series is computed. A read-only check of production found 6,002chart_seriesrows, 535 of them with metric sources and 776 distinct endpoint URLs. Every one of those URLs is private (10.3.x,10.30.x,172.29.x,10.0.x,172.16.x,10.49.x), so stored rows would not change andCHART_SERIES_VERSIONstays at 21. New and recomputed series get the rules.What gets replaced with
***REDACTED***:hf_,ghp_/gho_/ghu_/ghs_/ghr_,github_pat_,AKIA…/ASIA…,xox?-,sk-,nvapi-and JWTs;Authorization: Bearer|Basic|Token <value>, and a bareBearerfollowed by a long token (kept when the value is a slash path without digits, likebearer src/auth/…);*_TOKEN,*_API_KEY,*_SECRET,*_ACCESS_KEYand*_PASSWORDassignments, also with JSON-escaped quotes (\"MY_SECRET_TOKEN\":\"…\"), unless it is a placeholder ($VAR,<…>,***, a number,none);*_token,*api_key,*_secretand*_passwordassignments and of--*-token,--api-key,--*-secretand--*-passwordflags, when the value mixes letters and digits;scheme://user:pass@, with any scheme case and JSON-escaped:\/\/);*.oraclevcn.comhosts;owner/repo,owner%2Frepoand the repository name, with-and_matching each other, wherever no letter or digit continues it (soname-server-1andname_defaultlose it too).All of these are also found right after an ANSI CSI sequence ending in a letter (colour
\x1b[0m, erase\x1b[2K, cursor\x1b[1A), after its escaped spellings (\x1b[,\u001b[,\033[) and after an escaped\n,\ror\t.What is deliberately kept:
10/8,172.16/12,192.168/16,100.64/10,127/8,169.254/16);*.internal,*.svc.cluster.local, SLURM host names);/home/cam),user@hostwithout a TLD or with an internal one (.internal,.local,.lan), scp-style remotes ([email protected]:org/repo), URL userinfo without a password,[email protected],@scope/pkg, image digests (img@sha256:…), decorators and[email protected](…);==4.15.4.0,cudnn_cu13-9.20.0.48, pip's(9.19.0.56), and the version column ofpip list,conda listand torch's[conda]dump, when the package name has a lower-case letter and no address-like word (MASTER_ADDR 203.0.113.7,mq_connect_ip …andnode-a …are redacted);initial-cluster-token: etcd-cluster,bytes_per_full_token=13125.54,eos_token=</s>,hf_token=None,--api-key EMPTY;Important
Private addresses and node names stay, by decision. Alec decided to keep private IPs and internal host names. So the private IP that prompted this work (
192.168.95.13, 23 times in point 439934) stays visible after this PR and after the backfill, as do about 115k private IP hits across 207 of 243 sampled points. Email addresses are redacted, also by his decision.Warning
Raw copies outside this database are not covered.
inferencemax-gha-backuplistsserver_logs_*.zipartifacts anonymously, and public-repo GitHub artifacts keep raw logs for 90 days. Bucket access is being raised with Alec separately and is not changed here. Tokens that may have leaked should be rotated.s-maxage=31536000, so the CDN serves the old text until the purge below. Browsers may keep it for up to an hour.PUBLIC_DATABASE_READONLY_URLneed their own purge. Ones that synced runs need their own backfill, with--downstream.Python counterpart. SemiAnalysisAI/InferenceX#5013 (still open) applies the same rules in the uploader. Both repos test against the same
log-redaction.vectors.json, which oxfmt leaves alone so the bytes stay identical. #5013 has to copy the file and matchlog-redaction.ts.re.ASCII, otherwise\w,\band\dtreat CJK text as word characters, and密钥hf_…leaks. The CSI and escape boundaries and the key checks are variable-length lookbehinds, so the port needs theregexmodule, or a pre-pass that finds them.Authorization/Bearer, with the slash-path exception for a bareBearer; upper-case, lower-case, JSON-escaped and command-line secret assignments with the placeholder list, where lower-case keys and flags need a value that mixes letters and digits;nvapi-andASIAkeys; case-insensitive and JSON-escaped URL passwords; email, applied after URL passwords and keeping internal TLDs and matches followed by(or:plus a non-space. Two version rules look back at most 1,024 characters to the start of the line. A dotted quad in parentheses is kept on aRequirement already satisfied:line. One after a[conda]/[pip3]prefix or a package name containing-or_padded by two or more spaces is kept too, if that name has a lower-case letter and matches none ofhost|addr|ip|url|uri|endpoint|server|peer|remote|bind|master|node|target.jwt access token,lone base64 json segment kept,pip installed version kept,public ipv4 in parentheses,public mq_connect_ip.email in a home path,email with subdomains and sentence period,short home username kept,scp-style git remote kept,url userinfo without password kept,user at host without tld kept,version specifiers and image digests kept,decorator kept.public ipv4 after ansi colour code,hf token after ansi colour code,email after ansi colour code keeps the code,public ipv4 after escaped newline and before escaped tab,github token after escaped newline,public ipv6 after escaped newline,email after escaped newline keeps the escape,public ipv4 after erase-line code,hf token after cursor-up code,escaped ansi codes in a repr,email after escaped unicode ansi code keeps the code.authorization bearer header,authorization basic header,bare bearer token,basic and bearer in prose kept,secret assignments,placeholder and numeric assignments kept,nvidia api key,aws temporary access key,url password with uppercase scheme,url password with json-escaped slashes,json-escaped secret assignment,lower-case secret assignments,command-line secret flags,tokenizer settings and placeholder flags kept,bearer before a source path kept,bearer token with slashes and digits.internal tld after at sign kept,matrix multiply call kept,pip list version column kept,conda environment version column kept,public ipv4 in a two-column line,non-ascii text next to an ip and a token,aligned address key/value lines,aligned package rows kept.compact json url next to an email keptis renamedcompact json url next to an email, and its email is now redacted.placeholder and numeric assignments keptnow ends withhf_token=Noneinstead ofhf_token=lowercase-value, which is redacted now.Running the backfill
Run it once, right after this PR is deployed. Rerun it after any later change to the rules. Point
DATABASE_WRITE_URLat the production database's direct endpoint, without-pooler. SetGITHUB_TOKENso the visibility checks are authenticated. Run it from an operator machine, not CI, so the URL map below stays on that machine.Expected run, from read-only counts of production:
html_urlfor 27 runs, 19 fromNVIDIA/nv-perf-sa-reviewand 8 fromSemiAnalysisAI/InferenceX-Private-TPU, and sanitizes their 120 logs. First it appends each run'sgithub_run_id,run_attemptandhtml_urlto an operator-only JSONL file and prints the file's path, never its contents. The default is~/.inferencex/redacted-run-urls/, and--url-map <path>overrides it. The file is set to mode 600 after every append, even if it already existed. Keep that file out of git and CI logs. It is the only record of those runs' repositories.sync-public-dbrecords the URLs it does not copy the same way.--writereports0 of N file(s) sanitizedand0 run URL(s).The backfill only writes these:
server_logs.server_log;server_log_files.log_text;server_log_blocksandserver_log_block_filesrows of a changed file, rebuilt from the sanitized text in the same transaction. Blocks under already-sanitized text are rebuilt too when their character count differs or, for text holding***REDACTED***, when they decode to different text.workflow_runs.html_urlof private-repository runs, written only after every file succeeded so that a rerun still knows which names to remove.Each file is sanitized under a per-file advisory lock that
compact-server-logsnow also takes, so the two cannot interleave. The backfill exits 1 whenever a file failed, in every mode. On a downstream deployment's own database, use--downstream. It applies the shared rules, keeps that deployment's private repository names and run URLs, and never asks GitHub.Admin backfills that read artifacts (
backfill-server-log-files,backfill-gpu-metrics,backfill-runtime-metadata) read every URL map in~/.inferencex/redacted-run-urls/and use a cleared run's recorded repository. Any other run withouthtml_urlfalls back toINGEST_REPOas before, which covers the 11 production runs (2026-01-21 to 2026-09-10) ingested without GitHub metadata. I chose the URL maps over a marker column because a column needs a migration. GitHub run IDs are unique across repositories, so a cleared run missing from the maps (for example on a CI runner) reads as not found inINGEST_REPO, never as another run's data.Risks
sync-public-db --to-publicdeletes the source run. Async-public-dbrun in CI writes its map on the runner, where it is lost when the job ends.--run-id. 94 files hold more than 256 M characters and the largest holds 952 M, which needs several GB of memory per worker. Keep--concurrencylow.***REDACTED***. Raw blocks under text with no redaction at all are impossible, because the redaction itself writes that string.sync-public-dbruns at module top level, so its sanitization and URL recording are untested.Validation details
Coverage on real logs. I took a read-only sample through
DATABASE_READONLY_URL. It covers the newest point for each model, hardware, framework, multinode and repository combination: 243 points, 19 models, 12 hardware types and 3 repositories. That came to 1,765 files and 399 MB, using the first 3 MB of each primary and 1.5 MB of up to 8 child files. The temp directory and env file were deleted afterwards.mq_connect_ip,distributed_init_method=tcp://…). 18 are SGLang's placeholderbootstrap_host=2.2.2.2, harmless to redact.*.oraclevcn.comwatchtower-navy-cn15.sub….gb200manual.oraclevcn.comX-Xet-Access-Tokenin a dumped header/home/<email>/.cache/atom/torch_compile_cachepathshf_, GitHub, AWS, Slack,sk-, URL passwords, public IPv6HF_TOKEN(118 hits ofHF_TOKEN": "***REDACTED***)nv-perf-sa-review.sanitizeLogTextremoves it during sync and backfill.Authorization, upper-case, lower-case, JSON-escaped and command-line secret assignments,nvapi-,ASIA, JSON-escaped URL passwords"initial-cluster-token":"etcd-cluster"(27 hits) andbytes_per_full_token=13125.54(44 hits). Now old and new rules give identical output on all 1,765 files.10.30.1.93,172.16.0.144,192.168.95.21im-b200-c006.nsc-sa.internal,worker-12.soperator-worker-svc.soperator.svc.cluster.local,mia1-p01-g14,dsxe-sa-b300-prd0-gpu-10/home/cam(others aresa-shared,runner)glpat-,AIza,npm_,pypi-False positives found and fixed: pip's
Requirement already satisfied: … (9.19.0.56)suffix, 18 hits over 6 versions. No other version string, model path or metric number was redacted. After redaction, 661@tokens stay in the sample, all of themgit+https://…@<sha>, image digests,pkg@version, Go module paths and decorators such as`@tilelang.jit`.Benchmark (
redactTexton 100 MB synthetic text, one process per case, at three heads):cd228ea02b6834c9c0*_tokens=settinga.repeats (no whitespace)de-ad-be-ef-repeatsx (198.51.100.7)The synthetic log line is digit-dense, so the wider CSI lookbehind costs more there than on real logs. On the 399 MB real sample,
b6834c9c0took 4.9 s and this head takes 5.2 s.Tests.
bun:test, and the database tests use the real postgres.js driver throughpgliteDriverSql.stored-redaction.test.tscovers the backfill. A dry run leaves every table byte-identical. A write followed by a second write gives identical snapshots, and the second write reports 0 changes.configs,benchmark_resultsand everyworkflow_runscolumn except a private run'shtml_urlstay unchanged, and rebuilt blocks decode to the sanitized text. Private-repository runs lose their name and URL while public runs keep theirs, and--run-idleaves other runs alone. Other cases cover the URL map (content, mode 600, directory 700),--downstream(no GitHub call, names and URLs kept), stale blocks under already-sanitized text (different length, and raw100.200.100.20blocks under same-length***REDACTED***text), the advisory lock that the backfill andcompactStoredServerLogFiletake, and exit code 1 for a--downstreamrun whose file update a trigger refuses.compute-chart-series.test.tschecks that public endpoint URLs are redacted in metric sources (with#2for a collision) and private ones are kept.repo-visibility.test.tscovers the widened name forms andGITHUB_TOKEN.runtime-metadata-artifacts.test.tschecks that a cleared run takes its repository from the URL map and that any other run without a URL is left to theINGEST_REPOfallback.redacted-run-urls.test.tschecks that an existing 644 map becomes 600, that every map in the directory is read, and that a malformed line is rejected.agentic-backfill-integrity.test.tschecks the hashed manifest database, including two databases on one host.benchmark-ingest-upsert.test.tschecks that ingest stores sanitized text and blocks.chmodremoved, the URL-map lookup test, the same-host manifest test, and the two files whose new exports were missing. Vectors that guard against over-redaction or pin the Python port pass either way:basic and bearer in prose kept,placeholder and numeric assignments kept,public ipv4 in a two-column line,non-ascii text next to an ip and a token,aligned package rows kept,tokenizer settings and placeholder flags keptandbearer token with slashes and digits.Checks run.
bun run lint,bun run fmtandbun run typecheckpass.bunx tsc --noEmit -p packages/app/tsconfig.jsonpasses.bun run --cwd packages/db test:unitpassed twice (1,835 tests), andbun run test:unitpassed once. The skills integrity refresh produced no change.AI model disclosure
PR checklist
inferencex-skillschanges/zhsiblingdocs/chinese-copy.md中文
CI 服务器日志存储在数据库中,并通过
/api/v1/server-log、/api/v1/server-log-search和日志查看器公开提供。此前日志按原样存储。对生产环境的只读抽样发现了公网主机 IP(如mq_connect_ip=107.191.51.58)、Oracle VCN 主机名、一个 HF Xet 访问令牌(JWT)、家目录路径中一位员工的邮箱,以及在三份日志中出现 112 次的 NVIDIA 私有仓库名称。本 PR 在三处清理日志文本。新摄取的数据在写入前经
etl/log-redaction.ts清理(主文件、子文件及其数据块)。sync-public-db同样清理,并对非公开仓库的运行移除仓库名,不写入html_url。已存储的数据由bun run admin:db:backfill-log-redaction回填。读取接口不做实时清理,因此在执行--write回填并清除日志缓存之前,旧数据仍然公开可见。跟踪回放的服务器指标接口现在在计算图表序列时,对来源端点 URL、来源 ID 和引擎标签应用同样的规则。只读检查显示,生产环境有 6,002 行
chart_series,其中 535 行含来源,共 776 个不同的端点 URL,全部是私有地址,因此已存储的数据不会变化,CHART_SERIES_VERSION保持 21。会被替换为
***REDACTED***的内容包括:访问令牌(含 JWT、nvapi-、ASIA)、Authorization: Bearer|Basic|Token的值和较长的独立 Bearer 令牌(不含数字的斜杠路径如bearer src/auth/…除外)、值不是占位符的大写*_TOKEN、*_API_KEY、*_SECRET、*_ACCESS_KEY、*_PASSWORD赋值(包括 JSON 转义引号的写法)、值同时含字母和数字的小写*_token、*api_key、*_secret、*_password赋值以及--*-token、--api-key等命令行参数、URL 密码(任意大小写协议和 JSON 转义的:\/\/)、公网顶级域名的邮箱、公网 IPv4/IPv6、*.oraclevcn.com的子网部分,以及非公开仓库的各种写法(owner%2Frepo、-与_互换,以及后面不紧跟字母或数字的仓库名)。紧跟在以字母结尾的 ANSI CSI 序列(颜色\x1b[0m、清行\x1b[2K、光标\x1b[1A)、其转义写法(\x1b[、\u001b[、\033[)或转义的\n、\r、\t之后的内容同样会被识别。刻意保留的内容包括私有、回环、链路本地和 CGNAT 地址,内部节点名,形似邮箱但并非邮箱的内容(短用户名、没有顶级域名或使用内部顶级域名的user@host、[email protected]:org/repo、不含密码的 URL 用户信息、[email protected]、@scope/pkg、镜像摘要、装饰器和[email protected](…)),包版本号(包括 pip 的(9.19.0.56)以及pip list、conda list和 torch[conda]输出中的版本列,前提是包名含小写字母且不含addr、ip、node等地址类词语),名称像密钥的普通设置(initial-cluster-token: etcd-cluster、bytes_per_full_token=13125.54、eos_token=</s>、hf_token=None),以及时间戳、GPU UUID 和指标数值。策略决定。 Alec 决定保留私有 IP 和内部主机名,因此触发此项工作的
192.168.95.13在本 PR 和回填之后仍然可见。邮箱地址按他的决定进行清理。数据库之外的原始副本不在本 PR 范围内。 GCS 备份桶
inferencemax-gha-backup可以匿名列出server_logs_*.zip,公开仓库的 GitHub artifact 也会保留原始日志 90 天,桶的访问权限另行与 Alec 讨论,本 PR 不做改动;可能泄露的令牌应当轮换。日志响应带有s-maxage=31536000,在执行下面的缓存清除之前 CDN 会继续提供旧文本,浏览器最多缓存一小时。通过PUBLIC_DATABASE_READONLY_URL读取公共数据库的下游部署需要各自清除缓存,同步过运行的下游部署需要用--downstream各自回填。回填之前创建的 Neon 子分支、预览分支和时间点恢复历史仍保留原始文本。Python 对应实现。 InferenceX#5013(尚未合并)在上传端应用相同规则,两边共用
log-redaction.vectors.json。#5013 需要复制该文件并与log-redaction.ts保持一致:正则须使用re.ASCII编译(否则中文等字符会被当作单词字符,导致密钥hf_…泄露),CSI 与转义边界以及密钥键的校验是变长后行断言,需要regex模块或预处理。新规则包括 JWT、Authorization/Bearer(含斜杠路径例外)、大写、小写、JSON 转义和命令行形式的密钥赋值(小写键和参数要求值同时含字母和数字)、nvapi-与ASIA密钥、大小写不敏感和 JSON 转义的 URL 密码、邮箱,以及两条最多回看 1,024 个字符的版本规则(版本列规则要求包名含小写字母且不含地址类词语)。共新增 48 个用例,修改 2 个:compact json url next to an email kept改名为compact json url next to an email且其中的邮箱现在会被清理;placeholder and numeric assignments kept的结尾由hf_token=lowercase-value改为hf_token=None。回填。 在本 PR 部署后,从操作者本机(不要在 CI 中)设置
GITHUB_TOKEN后执行一次:先用--run-id 31893747354试运行,再执行--write --concurrency 2,最后运行bun run admin:cache:invalidate -- https://inferencex.semianalysis.com --immediate。回填会扫描约 11.98 万个文件(约 3300 亿字符),抽样中约 1.6% 的文件会被修改,并清空 27 个私有仓库运行的html_url。清空之前,每个运行的github_run_id、run_attempt和html_url会追加到仅操作者可读的 JSONL 文件(默认~/.inferencex/redacted-run-urls/,可用--url-map指定,每次追加后权限都设为 600),只打印文件路径,请勿提交到 git 或出现在 CI 日志中。回填只修改日志文本列、相关数据块,以及私有仓库运行的html_url;每个文件在一把compact-server-logs也会获取的 advisory 锁下各自一个事务处理,可以安全地重复执行。对已清理文本,字符数不一致的数据块会重建,含***REDACTED***的文本还会解码数据块比对。只要有文件失败,回填就以 1 退出,--downstream也一样。下游数据库请使用--downstream,只应用通用规则,保留其私有仓库名和运行 URL,也不调用 GitHub。backfill-server-log-files、backfill-gpu-metrics、backfill-runtime-metadata会读取~/.inferencex/redacted-run-urls/下的全部映射文件,被清空 URL 的运行使用记录的仓库,其他没有html_url的运行(如生产环境 11 个从未有过 URL 的运行)仍回退到INGEST_REPO。选择映射文件而不是新增标记列,是因为后者需要数据库迁移。GitHub 运行 ID 在各仓库之间唯一,因此映射中缺失的已清空运行在INGEST_REPO中只会显示为找不到,不会读到其他运行。风险。 被清空的运行 URL 只能通过映射文件恢复,
--to-public还会删除源运行;在 CI 中运行的sync-public-db会把映射文件写在运行器上,作业结束后即丢失。回填会完整读取所有日志,最大的文件有 9.5 亿字符,请使用较低的并发。规则在真实日志上比本 PR 最初版本约慢 1.6 倍(399 MB 由 3.3 秒变为 5.2 秒),最近一轮只增加约 5%。数据块解码比对只针对含***REDACTED***的文本。sync-public-db的改动没有直接测试。验证。 抽样覆盖 243 个数据点、19 个模型、12 种硬件和 1765 个文件。新规则在样本上与上一版输出完全一致(样本中有 700 万个颜色码、1300 多个其他 CSI 序列,紧跟其后的约 3,800 个 IP 全部是私有地址);小写键规则加入"字母加数字"要求之前出现的两类误报(
initial-cluster-token27 处、bytes_per_full_token44 处)已消除。在 100 MB 的极端合成数据上,原先需要 45 秒以上或超过 60 秒的情况现在约 1 秒完成。每项修复都有在去掉修复后会失败的测试。lint、fmt、typecheck、app tsc 均通过,packages/db单元测试运行两次(1,835 个)、全部单元测试运行一次,均通过。