fix(accounts): enforce blocked usernames containing special characters#39183
fix(accounts): enforce blocked usernames containing special characters#39183sahillllllllll-bit wants to merge 1 commit intoRocketChat:developfrom
Conversation
|
Looks like this PR is not ready to merge, because of the following issues:
Please fix the issues and try again If you have any trouble, please check the PR guidelines |
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
📜 Recent review details🧰 Additional context used📓 Path-based instructions (1)**/*.{ts,tsx,js}📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
Files:
🧠 Learnings (2)📚 Learning: 2026-02-26T19:25:44.063ZApplied to files:
📚 Learning: 2026-02-26T19:25:44.063ZApplied to files:
🔇 Additional comments (1)
WalkthroughUpdated username blacklist check to test the raw trimmed username directly against RegExp patterns without escaping special characters first. This allows blocked usernames containing regex metacharacters (such as Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Suggested labels
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@ggazzo please have a look at this issue ? |
Closes #39182 1st part
Summary
This PR fixes an issue where usernames containing regex special characters (e.g.,
.,+,*) were not properly enforced when added toBlocked UsernameList.Previously, the username was escaped both when constructing the blacklist regex and again when testing it. This double escaping caused blocked usernames such as
john.doeto bypass validation.Changes
escapeRegExpcall when testing usernames against the blocked list.Result
Usernames explicitly added to
BlockedUsernameListare now consistently enforced, regardless of whether they contain special characters.Summary by CodeRabbit