Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Telemetry scrubber: case-insensitive mysql rule redacts an attached port (-P3306) and lets a real password survive in the same command

未关闭 适合新手
#815 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
82/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
mysql, typescript
领域
backend, security

调研方向

从server/src/telemetry/scrub.ts开始,检查 mysql 凭据规则及其相邻的 sshpass 规则。为混合使用-P3306和-phunter2的命令、小写且连写的-p3306以及mysql -p database添加测试;确认端口和数据库名称得以保留,同时实际凭据会被隐藏。

由索引模型根据 Issue 内容生成。

描述

Summary

In server/src/telemetry/scrub.ts, the tool-anchored mysql credential rule keeps the i flag:

[
  /(\bmysql(?:dump)?\b(?:[^|;&\\\r\n]|\\[\s\S])*?(?:[ \t]|\\\r?\n)-p)("[^"]*"|'[^']*'|[^\s'"-]\S*)/gi,
  (_m, lead) => `${lead}${REDACTED}`,
],

i makes (?:[ \t])-p match the uppercase attached port form -P3306 (mysql's syntax for --port attached to a single dash). Because the g continuation after the first match never sees another \bmysql\b anchor, a real password later in the same command line is not redacted.

Repro (upstream tree at e8bb2736)

scrubCommand("mysql -h db -P3306 -phunter2 app")
→ "mysql -h db -P[REDACTED] -phunter2 app"

The port is redacted as if it were a secret, and the actual password -phunter2 survives into OTLP export — contrary to the module header's stated priority ("a secret that survived costs a rotation") and to the sibling sshpass rule, which is deliberately case-sensitive with the comment "Case matters here: -P is sshpass's prompt".

Suggested fix

Drop i from the mysql rule (/gi → /g), matching the sshpass rule's convention:

  • mysql -h db -P3306 -phunter2 app → mysql -h db -P3306 -p[REDACTED] app
  • lowercase -p3306 (attached password form) is still redacted
  • mysqldump -phunter2 db unchanged

Tests worth pinning: the mixed -P/-p command above, the lowercase attached form, and mysql -p database (space form = interactive prompt, database name must not be redacted).

Context: we hit this in a downstream deployment while extending coverage for SSHPASS=… sshpass -e and docker <global-options> login -p …; the case-sensitivity divergence was found by a full-scope review pass. Happy to send a PR if wanted.

主要语言
TypeScript
星标
6.6k
派生
914
平均合并
22 小时 44 分钟
30 天内合并 PR
137

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

CopilotKit/OpenBot 的其他 Issue

查看 CopilotKit/OpenBot 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。