Skip to content

fix(banlist): hide comment author/editor under banlist.hideadminname (#1500)#1501

Merged
rumblefrog merged 1 commit into
mainfrom
fix/1500-hideadminname-comments
Jun 9, 2026
Merged

fix(banlist): hide comment author/editor under banlist.hideadminname (#1500)#1501
rumblefrog merged 1 commit into
mainfrom
fix/1500-hideadminname-comments

Conversation

@rumblefrog

Copy link
Copy Markdown
Member

Summary

Closes #1500.

banlist.hideadminname masked the focal ban/comm admin name and the unban "removed by" admin for public viewers, but the per-row comment author and editor (also admin usernames) leaked across every comment surface:

  • the inline <details> comment disclosure on the public banlist + commslist,
  • the ?comment=N "Other comments" comment-edit view (reachable by any caller, no admin gate),
  • the JSON drawer (bans.detail / comms.detail) rendered by theme.js.

This suppresses the comment author + editor for public callers when hideadminname is on, matching the existing focal admin.name / removed_by gate.

Changes

  • Data layer (page.banlist.php, page.commslist.php): null comname / editname for public viewers on both the inline-disclosure path and the ?comment=N othercomments path, so a third-party theme rendering the name directly can't re-leak it. edittime is preserved so the "last edit" indicator still shows.
  • Templates (page_bans.tpl, page_comms.tpl): three-way Hidden / name / "deleted admin" branch for author and editor; the edit line now gates on edittime (not the now-nullable editname).
  • API (bans.php, comms.php): null comment author / edited_by and add an author_hidden boolean sentinel.
  • Drawer (theme.js, partials/player-drawer.tpl): use author_hidden to render "Hidden" (policy) distinctly from "unknown" (deleted admin → author already null).

Defense-in-depth: the name is removed at the data/API layer (protects custom themes and curl callers), with the default theme rendering the nicer "Hidden" placeholder on top.

Test plan

  • BanlistCommentsVisibilityTest — inline disclosure + ?comment=N author/editor-hidden branches + admin control (13 tests, 47 assertions).
  • BansTest / CommsTest::testDetailHidesCommentAuthorForPublicWhenHideAdminName — API author / edited_by / author_hidden contract for public + admin (94 tests, 462 assertions).
  • Snapshot bans/detail_admin_view.json updated for the new author_hidden field.
  • PHPStan clean (level 5).

Notes

Out of scope (separate follow-up, not a name leak): the ?comment=N comment-edit view renders comment bodies regardless of config.enablepubliccomments. Documented as a known follow-up in the AGENTS.md row.

…1500)

The `banlist.hideadminname` setting masked the focal ban/comm admin name
and the unban "removed by" admin for public viewers, but the per-row
comment author and editor (also admin usernames) leaked across every
comment surface: the inline `<details>` disclosure on the public banlist
+ commslist, the `?comment=N` "Other comments" comment-edit view
(reachable by any caller), and the JSON drawer (bans.detail /
comms.detail) consumed by theme.js.

Suppress the comment author + editor for public callers when
hideadminname is on, matching the focal admin.name / removed_by gate:

- Page handlers (page.banlist.php, page.commslist.php) null comname /
  editname at the DATA layer for both the inline-disclosure data path
  and the ?comment=N othercomments path, so a third-party theme that
  renders the name directly can't re-leak it. edittime is preserved so
  the "last edit" indicator survives.
- Templates (page_bans.tpl, page_comms.tpl) render a three-way
  Hidden / name / "deleted admin" branch for both author and editor,
  gating the edit line on edittime (not editname, now nulled).
- API handlers (bans.php, comms.php) null the comment author /
  edited_by and add an `author_hidden` boolean sentinel so the drawer
  (theme.js, partials/player-drawer.tpl) renders "Hidden" (policy)
  distinctly from "unknown" (deleted admin).

Regression coverage: BanlistCommentsVisibilityTest gains the
?comment=N author/editor-hidden branches + an admin control; BansTest /
CommsTest::testDetailHidesCommentAuthorForPublicWhenHideAdminName assert
the author / edited_by / author_hidden API contract. Snapshot
detail_admin_view.json carries the new author_hidden field.
@rumblefrog
rumblefrog added this pull request to the merge queue Jun 9, 2026
Merged via the queue into main with commit 09ae21f Jun 9, 2026
6 checks passed
@rumblefrog
rumblefrog deleted the fix/1500-hideadminname-comments branch June 9, 2026 21:34
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 9, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Comms details slide in panel leaks admin name when $hideadminname is enabled

1 participant