fix(settings): escape group names in the users admin group list - #41758
Merged
Conversation
GroupList.addGroup() built each list item by concatenating the group id and group name into an HTML string, which jQuery then parses as markup. Unlike usernames, group names are not restricted to an allow-listed character set - Group\Manager::createGroup() only rejects empty and untrimmed names - so those values were not rendered verbatim. Both interpolated values now go through escapeHTML(), the same helper already used for the group and quota values in the user rows, so the encoding is consistent across the users administration panel. escapeHTML() covers the attribute and the text context, and data-gid still round-trips as the literal string, so getGroupLI() lookups keep matching. Adds regression tests for the escaping to the settings karma suite. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>
DeepDiver1975
force-pushed
the
fix/escape-group-names-in-group-list
branch
from
July 29, 2026 07:48
49ab896 to
aea1c7d
Compare
phil-davis
approved these changes
Jul 29, 2026
Contributor
|
Manually checked this, and it is fixed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
GroupList.addGroup()insettings/js/users/groups.jsbuilt each list item of theusers administration group list by concatenating the group id and the group name
into an HTML string, which jQuery then parses as markup. Both interpolated values
are now passed through the existing
escapeHTML()helper (core/js/js.js), so thevalues are rendered verbatim.
escapeHTML()covers both contexts the values appear in - thedata-gidattributeand the
.groupnametext node - anddata-gidstill round-trips as the literalstring, so
getGroupLI()lookups keep matching.Adds three regression tests to
settings/tests/js/users/groupsSpec.js, which isalready wired into the
settingskarma suite.Related Issue
n/a - no tracking issue.
Motivation and Context
Unlike usernames, group names are not restricted to an allow-listed character set:
Group\Manager::createGroup()only rejects empty and untrimmed names, and namescan also originate from an external backend such as LDAP. Group and quota values
in the user rows of the same panel (
settings/js/users.js) already go throughescapeHTML(), so this makes the output encoding consistent across the usersadministration panel.
The PHP template
settings/templates/users/part.grouplist.phprenders group nameswith
p()and was already correct - only the JS render path was affected.How Has This Been Tested?
settings/js/users/groups.jswith the repo's vendored jQuery and the realescapeHTML()extracted fromcore/js/js.js<script>markup - renders as text, no<script>element in the rowcreated and
data-gidstill reads back as the literal string<img src=x onerror="...">- noimgelement inside.groupname, name renders as textadds new user groupspec still passes (4/4)make test-jsrunner was not executed locally - CI (js-unit.yml) covers it<img src=x onerror=alert(1)>inSettings -> Users; the name renders as literal text, both on creation and after
a group-membership toggle (which re-renders via
GroupList.update())Screenshots (if appropriate):
n/a
Types of changes
Checklist: