# AI Summary leaking hidden tags

**URL:** https://meta.discourse.org/t/ai-summary-leaking-hidden-tags/389292
**Category:** Bug
**Tags:** ai, fixed
**Created:** [November 20, 2025, 10:32pm UTC](https://meta.discourse.org/t/ai-summary-leaking-hidden-tags/389292 "2025-11-20T22:32:47Z")
**Posts on this page:** 1
**Showing post:** 5

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [December 2, 2025, 2:07pm UTC](https://meta.discourse.org/t/ai-summary-leaking-hidden-tags/389292/5 "2025-12-02T14:07:08Z")

</div>

> <https://github.com/discourse/discourse/pull/36167>
>
> Hidden tags (restricted to specific user groups via tag group permissions) were …being included in AI-generated topic summaries.
> 
> \## Changes
> 
> \- Filter tags using \`Guardian.new(nil)\` to get only publicly visible tags
> \- Add migration to delete existing summaries containing hidden tags  
> \- Add test coverage for hidden tag filtering
> 
> \## Technical Details
> 
> The fix uses \`topic.visible\_tags(Guardian.new(nil))\` which:
> \- Operates on already-loaded tag associations (efficient)
> \- Uses anonymous guardian for most restrictive permissions
> \- Benefits from guardian memoization
> \- Follows standard Discourse pattern
> 
> The migration uses a single regex query to match all hidden tags efficiently, erring on the side of caution since summaries regenerate automatically.

---

_[View the full topic](https://meta.discourse.org/t/ai-summary-leaking-hidden-tags/389292)._
