Skip to content

Fix stored XSS in Group name (CVE-2024-25891-98)#7675

Merged
DawoudIO merged 8 commits intomasterfrom
fix/issue-6848-group-xss
Nov 30, 2025
Merged

Fix stored XSS in Group name (CVE-2024-25891-98)#7675
DawoudIO merged 8 commits intomasterfrom
fix/issue-6848-group-xss

Conversation

@DawoudIO
Copy link
Contributor

What Changed

Add input sanitization and output escaping for group names:

Input sanitization:

  • Add strip_tags() when creating/updating groups in people-groups.php API

Output escaping with htmlspecialchars():

  • GroupView.php: page title, card header, delete confirmation dialog
  • SundaySchoolReports.php: group select dropdown
  • CartToGroup.php: group select dropdown

Fixes #6848

Type

  • ✨ Feature
  • 🐛 Bug fix
  • ♻️ Refactor
  • 🏗️ Build/Infrastructure
  • 🔒 Security

Testing

Screenshots

Security Check

  • Introduces new input validation
  • Modifies authentication/authorization
  • Affects data privacy/GDPR

Code Quality

  • Database: Propel ORM only, no raw SQL
  • No deprecated attributes (align, valign, nowrap, border, cellpadding, cellspacing, bgcolor)
  • Bootstrap CSS classes used
  • All CSS bundled via webpack

Pre-Merge

  • Tested locally
  • No new warnings
  • Build passes
  • Backward compatible (or migration documented)

Add input sanitization and output escaping for group names:

Input sanitization:
- Add strip_tags() when creating/updating groups in people-groups.php API

Output escaping with htmlspecialchars():
- GroupView.php: page title, card header, delete confirmation dialog
- SundaySchoolReports.php: group select dropdown
- CartToGroup.php: group select dropdown

Fixes #6848
@DawoudIO DawoudIO added this to the 6.3.0 milestone Nov 30, 2025
Copilot AI review requested due to automatic review settings November 30, 2025 00:08
@DawoudIO DawoudIO requested a review from a team as a code owner November 30, 2025 00:08
@DawoudIO DawoudIO requested review from DAcodedBEAT, MrClever, bigtigerku, grayeul and respencer and removed request for a team November 30, 2025 00:08
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses CVE-2024-25891-98, a stored cross-site scripting (XSS) vulnerability in group names. The fix implements a defense-in-depth approach with both input sanitization and output escaping.

Key changes:

  • Input sanitization: Strips HTML tags from group names when creating/updating groups via the API
  • Output escaping: Applies htmlspecialchars() with ENT_QUOTES and UTF-8 encoding when displaying group names in HTML contexts
  • Coverage: Fixes XSS vulnerabilities in group selection dropdowns, page titles, card headers, and confirmation dialogs

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
src/api/routes/people/people-groups.php Adds strip_tags() sanitization to group name input in POST endpoints for creating and updating groups
src/GroupView.php Escapes group name output in page title, card header, and delete confirmation dialog
src/sundayschool/SundaySchoolReports.php Escapes group name in group selection dropdown options
src/CartToGroup.php Escapes group name in group selection dropdown options

}
$group->setName($groupSettings['groupName']);
$group->setName(strip_tags($groupSettings['groupName']));
$group->setDescription($groupSettings['description'] ?? '');
Copy link

Copilot AI Nov 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The description field should also be sanitized with strip_tags() for consistency with the group name field and to prevent stored XSS vulnerabilities.

Apply the same sanitization:

$group->setDescription(strip_tags($groupSettings['description'] ?? ''));

Copilot uses AI. Check for mistakes.
$group->setName($input['groupName']);
$group->setName(strip_tags($input['groupName']));
$group->setType($input['groupType']);
$group->setDescription($input['description'] ?? '');
Copy link

Copilot AI Nov 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The description field should also be sanitized with strip_tags() for consistency with the group name field and to prevent stored XSS vulnerabilities.

Apply the same sanitization:

$group->setDescription(strip_tags($input['description'] ?? ''));

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot open a new pull request to apply changes based on this feedback

DawoudIO added a commit that referenced this pull request Nov 30, 2025
Add strip_tags() sanitization when creating new calendars to prevent
XSS payloads from being stored in the database.

This is part of CVE-2023-24690 which covers multiple XSS vulnerabilities:
- Calendar Name XSS (fixed here)
- Group Name XSS (fixed in PR #7675)
- Group Description XSS (fixed in PR #7675)

Fixes #6444
Copy link
Contributor

Copilot AI commented Nov 30, 2025

@DawoudIO I've opened a new pull request, #7682, to work on those changes. Once the pull request is ready, I'll request review from you.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@DawoudIO
Copy link
Contributor Author

@copilot open a new pull request to apply changes based on the comments in this thread

Copy link
Contributor

Copilot AI commented Nov 30, 2025

@DawoudIO I've opened a new pull request, #7683, to work on those changes. Once the pull request is ready, I'll request review from you.

@DawoudIO DawoudIO merged commit 713fa24 into master Nov 30, 2025
7 checks passed
@DawoudIO DawoudIO deleted the fix/issue-6848-group-xss branch November 30, 2025 02:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants