Skip to content

Commit 20c6a35

Browse files
author
Lionel Laské
committed
Merge branch 'fix/chat-xss-vulnerability' of https://github.com/Alok-2005/sugarizer into pr/1939
2 parents 3155ff7 + 0b5b1bc commit 20c6a35

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

js/screens/loginscreen.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,14 @@ const LoginScreen = {
266266
}
267267

268268
else if (this.index.currentIndex === 1 && this.details.name.length > 0) { // name
269+
// Validate username - check for HTML characters
270+
const htmlChars = /[<>&"']/;
271+
if (htmlChars.test(this.details.name)) {
272+
this.warning.show = true;
273+
this.warning.text = this.$t("InvalidName");
274+
this.isLoading = false;
275+
return;
276+
}
269277
if (sugarizer.getClientType() === sugarizer.constant.webAppType || this.details.serverAddress.length > 0) {
270278
const info = await sugarizer.modules.server.getServerInformation(this.details.serverAddress);
271279
this.consentNeed = info.options['consent-need'];

js/screens/settings-aboutme.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,13 @@ const AboutMe = {
201201
this.close('about_me');
202202
return;
203203
}
204+
// Validate username - check for HTML characters
205+
const htmlChars = /[<>&"']/;
206+
if (htmlChars.test(this.name)) {
207+
this.warning.show = true;
208+
this.warning.text = this.$t('InvalidName');
209+
return;
210+
}
204211
if (nameChanged && await sugarizer.modules.user.checkIfExists(null, this.name)) {
205212
this.warning.show = true;
206213
this.warning.text = this.$t('UserAlreadyExist');

0 commit comments

Comments
 (0)