Commit Graph
29 Commits
Author SHA1 Message Date
nyaKazuhaandClaude Fable 5 55b9babb66 fix(official-sync): 代理凭据改由环境变量下传子进程
彻底收敛 1-2 的两处残留凭据暴露:

- 子进程 argv:daemon_child_args 不再把 --proxy <url> 写入子进程参数,改为
  只放不含凭据的内部 flag --proxy-from-env,真实 URL 经 BAT_OFFICIAL_SYNC_PROXY_URL
  环境变量下传。凭据从世界可读的 /proc/<pid>/cmdline(0444)转移到仅属主可读的
  /proc/<pid>/environ(0400);子进程解析后立即 env::remove_var,避免被 curl 等
  孙进程继承。
- 状态文件 at-rest:0600 状态文件的 command 字段不再含凭据。restart/reload 复用
  所需的 URL 改存专用 0600 文件 bat-proxy.secret,该文件永不进入状态输出或 --json;
  clean-stable 会在后台停止后清除它。

复用型 restart/reload 从 bat-proxy.secret 还原代理;凭据文件缺失时(如 clean-stable
后)明确报错要求重新传入 --proxy,而非静默丢弃代理。

验证:新增 curl_proxy_url、secret 文件 0600 往返、--proxy-from-env 读取并清除
环境变量的单测;真机起停 daemon 确认凭据不在 cmdline/状态文件/status --json,
仅在 0600 secret 文件与 owner-only environ;复用 restart 成功还原、clean-stable
后复用 restart 明确报错。

对应 issue #18 维护清单 1-2 残留项。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-16 05:20:22 -07:00
nyaKazuhaandClaude Fable 5 810b39c2cd fix(official-sync): 修复阻塞 clippy 门禁的两处告警
cargo clippy --workspace -- -D warnings 在 HEAD 上失败,阻塞项目验证门禁:
- resolve_bootstrap 因 c123f6c 新增 curl_proxy 参数达到 8 个,触发
  too_many_arguments。将 curl_command/curl_proxy/unzip_command 收拢为
  BootstrapTools 结构体,降到 6 个参数。
- visible_historical_failed_versions(169822a 引入)的显式生命周期可省略,
  触发 needless_lifetimes。按 clippy 建议省略。

对应 issue #18 维护清单 1-7。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-16 04:40:35 -07:00
nyaKazuhaandClaude Fable 5 eef8c52497 fix(official-sync): 脱敏代理凭据避免泄漏到日志与状态输出
两处代理凭据泄漏:
- redact_proxy_url 对无 scheme 的代理串(user:secret@host:port,curl 默认按
  http 处理)完全不脱敏,明文凭据会进入 progress 事件、daemon 日志和
  bat-events.jsonl。现对无 scheme 但含 userinfo 的情况一并脱敏。
- daemon 保存的 command 含原始代理 URL,经 RPC status 和 bat status --json
  回显到 stdout(会被监控采集)。新增 redact_command_proxy_credentials,在
  build_daemon_status_report 的对外拷贝里脱敏 --proxy 值;磁盘状态文件
  (0600)仍保留原始 command 供 restart/reload 复用。

残留:子进程 argv 仍可经 /proc/<pid>/cmdline 读到代理凭据,以及 0600 状态
文件内的 at-rest 凭据,二者受进程属主与文件权限约束,后续可改由环境变量下
传子进程进一步收敛。

对应 issue #18 维护清单 1-2。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-16 04:31:10 -07:00
nyaKazuha 060b7d73e5 fix(official-sync): 复用失败 staging 避免重复全量下载 2026-07-16 00:35:24 +08:00
nyaKazuha c123f6c0dc feat(official-sync): 支持本地代理下载官方资源 2026-07-16 00:12:27 +08:00
nyaKazuha 169822abaf fix(daemon): 区分当前下载与历史失败状态 2026-07-15 23:22:30 +08:00
nyaKazuha 5b31112e91 fix(daemon): 使用人类格式输出 RPC 下载进度 2026-07-15 23:05:28 +08:00
nyaKazuha 7890b667d7 fix(daemon): 去重失败版本并优化状态输出 2026-07-15 22:32:27 +08:00
nyaKazuha 60b8339ecb fix(official): 修正官方 hash 校验算法 2026-07-15 22:30:33 +08:00
nyaKazuha 90307a3243 feat: track official versions and import resources
Persist official version-state, extend CAS/ResourceRepository import classification, and add offline catalog and failure regression fixtures.

Fixes #13

Fixes #12

Fixes #8
2026-07-15 19:53:10 +08:00
nyaKazuha 4192d7ee4c fix: classify official download failures
Distinguish terminal HTTP errors from retryable CDN/network failures, record quarantined resources, and report failed download progress.

Fixes #7
2026-07-14 01:30:12 +08:00
nyaKazuha 25c2c4d40f feat: add official full pull smoke
Emit runtime download progress and validation summaries for official sync.

Add repeatable real-network full pull smoke runbook and script.

Fixes #4

Fixes #6
2026-07-14 00:48:59 +08:00
nyaKazuha 2ff99ae9e3 feat: publish official resources atomically
Fixes #9

Fixes #11
2026-07-14 00:10:39 +08:00
nyaKazuha 45aba2fb2b fix: harden official sync filesystem boundaries
Fixes #14
2026-07-13 23:17:52 +08:00
nyaKazuha 599ead8391 fix: serialize daemon control commands
Fixes #10
2026-07-13 22:02:11 +08:00
nyaKazuha 1bcb9c828a feat: summarize official validation results
Fixes #5
2026-07-13 01:06:37 +08:00
nyaKazuha e5fcf26e19 feat: validate official zip structure 2026-07-12 23:37:47 +08:00
nyaKazuha f7255f7c04 feat: improve bat daemon cli output 2026-07-12 23:04:13 +08:00
nyaKazuha 264e78c440 feat: harden official sync scheduling and integrity 2026-07-11 01:06:02 +08:00
nyaKazuha 2bdc55a1be feat: support cancellable official sync 2026-07-10 00:36:40 +08:00
nyaKazuha f704ec18c5 feat: add official sync startup banner 2026-07-07 23:00:02 +08:00
nyaKazuha ea0920e4e3 feat: add official sync progress logging 2026-07-07 22:13:07 +08:00
nyaKazuha b2d6871926 fix: harden official resource sync retries 2026-07-07 01:14:54 +08:00
nyaKazuha e0d43fb994 fix official auto discovery for current launcher manifest 2026-07-06 23:02:52 +08:00
nyaKazuha 789402c887 feat: add official resource sync pipeline
Add the production-facing official update service and bat-official-sync watch CLI for unattended resource synchronization.

Support launcher-resource discovery without installing the launcher, remote marker snapshots, local manifest audit and repair, official seed hash validation, bootstrap caching, richer Addressables coverage, SQLite resource persistence, and FFI JSON helpers.
2026-07-05 23:49:56 +08:00
nyaKazuha adc1cd5b91 feat: prepare experiment push package 2026-06-30 00:08:36 +08:00
nyaKazuha 3c00659691 refactor: reduce quality findings 2026-06-28 15:42:12 +08:00
nyaKazuha b202d7b231 feat: implement production cas v1 2026-06-28 12:39:17 +08:00
nyaKazuha dd53e3054e chore: establish development baseline 2026-06-28 01:27:09 +08:00