[Bug]: Config parse errors, with config.toml lines, are sent to every signed-in user

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

还没有人认领这个 Issue。

评估

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

调研方向

从 src/api/events.rs 第132行左右的订阅处理程序开始,这里每个订阅者都会收到事件;然后跟踪 me 和 libraries 是如何传入 translate 的。接着阅读 src/config/store.rs 第356行左右,准确查看 Event::ConfigError 携带的内容。完成标准是:非管理员收到不含错误文本的普通 ConfigChanged,管理员仍能看到该事件,并且管理员标志能够顺利传递给 translate;请参考现有事件测试中的模式。

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

描述

bug

[!NOTE]
This issue was written by Claude (Claude Opus 5.5) from a code review session with @PhrolovaMoe. It was found by reading the code and hasn't been reproduced on a running server.

Version

0.40.0 (feat/desktop, 017a837b)

Area

Config

What happened?

When config.toml changes on disk and fails to parse, the watcher sends Event::ConfigError with the parser's message (src/config/store.rs:356). The events subscription passes it to every subscriber, admin or not (src/api/events.rs:132). toml's error message quotes the offending line, so if that line holds a TMDB key, SMTP password or Torznab API key, every signed-in user receives it.

Steps to reproduce
  1. Sign in as a non-admin in one browser and keep a page open (it subscribes to events).
  2. Break a line containing a secret in config.toml, e.g. api-key = "abc (missing quote).
  3. The non-admin's events subscription gets a ConfigChanged with the line in error.
Expected behavior

Only admins get the error text; everyone else gets a plain ConfigChanged (or nothing).

Suggested fix

Filter Event::ConfigError (and ConfigChanged) by is_admin in translate, which needs the user's admin flag passed in alongside me and libraries.

主要语言
TypeScript
星标
4
派生
1
平均合并
4 小时 49 分钟
30 天内合并 PR
5

环境准备

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

从这里开始

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

tinystream-dev/tinystream 的其他 Issue

查看 tinystream-dev/tinystream 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

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