# Group Histories 的日志记录漏洞

**URL:** https://meta.discourse.org/t/logging-hole-for-group-histories/392942
**Category:** Bug
**Tags:** groups, staff-action-log
**Created:** [2026年一月8日 04:01 UTC](https://meta.discourse.org/t/logging-hole-for-group-histories/392942 "2026-01-08T04:01:41Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![MentalNomad](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mentalnomad/32/95159_2.png) [@MentalNomad](https://meta.discourse.org/u/MentalNomad)
#### Post date: [2026年一月8日 04:01 UTC](https://meta.discourse.org/t/logging-hole-for-group-histories/392942/1 "2026-01-08T04:01:41Z")

</div>

我最近需要查看某个成员是在何时被添加到具有“类别版主”权限的群组中的。

在使用图形用户界面（GUI）中群组的日志（logs）选项卡时，我很容易地看到了该成员何时被移除，但看不到他们何时被添加；看起来他们似乎从未被添加过。

在数据探索器（[Data Explorer](https://meta.discourse.org/t/32566?silent=true)）插件中进行了一些试验，证实了确实没有关于他们被添加的日志条目。

我们推测的情况是：在创建新群组（New Group）的 Discourse 页面上，用户在指定群组的同时被设置为所有者（Owner），因此当群组创建时，他们“已经”是成员了，所以没有生成关于他们被添加的日志条目。（从群组创建到一年后添加另一个成员期间，群组中没有其他添加记录，这本应是不可能的。）

Bug 修复？/ 功能建议：

为了准确的日志记录和取证，我建议在群组创建后，立即在 `group_histories` 中为设置群组所有者这一操作提供一个单独的条目行。这将确保它显示在群组管理页面的日志选项卡上，否则该页面会造成混淆。

（如果群组管理日志选项卡能显示群组创建日期会更好，但这可能更复杂。）

附注：我怀疑在创建新群组页面上添加的成员也存在同样的情况，但我尚未证实。

---

<div class="post-metadata">

### Author: ![martin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/martin/32/491371_2.png) [@martin](https://meta.discourse.org/u/martin)
#### Post date: [2026年一月9日 02:18 UTC](https://meta.discourse.org/t/logging-hole-for-group-histories/392942/2 "2026-01-09T02:18:55Z")

</div>

听起来是个好主意，我就要这个了。

---

<div class="post-metadata">

### Author: ![martin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/martin/32/491371_2.png) [@martin](https://meta.discourse.org/u/martin)
#### Post date: [2026年二月4日 06:21 UTC](https://meta.discourse.org/t/logging-hole-for-group-histories/392942/4 "2026-02-04T06:21:39Z")

</div>

抱歉，这花了一些时间，出现了其他优先事项。我已提交一个拉取请求（PR）供审查，应该不会太久了：

> <https://github.com/discourse/discourse/pull/37054>
>
> When creating groups, we weren't logging the group owner
> as being the owner in …group histories, nor were we logging
> them being added to the group. So it was not clear in the user
> logs where this user ever came from. This PR fixes the issue,
> and also converts the admin group create endpoint to use a
> service.
> 
> Now the logs look like this when a group is created:
> 
> \<img width="830" height="378" alt="image" src="https://github.com/user-attachments/assets/871e319a-5512-411e-8565-3b63803e688c" /\>
> 
> 
> c.f. https://meta.discourse.org/t/logging-hole-for-group-histories/392942

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2026年二月5日 22:38 UTC](https://meta.discourse.org/t/logging-hole-for-group-histories/392942/5 "2026-02-05T22:38:45Z")

</div>



---

<div class="post-metadata">

### Author: ![martin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/martin/32/491371_2.png) [@martin](https://meta.discourse.org/u/martin)
#### Post date: [2026年二月6日 03:35 UTC](https://meta.discourse.org/t/logging-hole-for-group-histories/392942/6 "2026-02-06T03:35:15Z")

</div>

好的，这已经合并了 🚀

---

<div class="post-metadata">

### Author: ![fzngagan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fzngagan/32/259349_2.png) [@fzngagan](https://meta.discourse.org/u/fzngagan)
#### Post date: [2026年九月17日 16:00 UTC](https://meta.discourse.org/t/logging-hole-for-group-histories/392942/13 "2026-09-17T16:00:01Z")

</div>

我们随后已添加了针对新建群组时的员工操作日志。您可以在管理后台的 `Logs and Screening` 页面查看创建该群组的用户以及创建时间戳。
