Skip to content

Commit

Permalink
escape userId before setting it as HTML attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
webzwo0i authored and rhansen committed Apr 8, 2021
1 parent 9408d43 commit a796811
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/static/js/chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ exports.chat = (() => {
'Replacing with "unknown". This may be a bug or a database corruption.');
}

msg.userId = padutils.escapeHtml(msg.userId);
const authorClass = `author-${msg.userId.replace(/[^a-y0-9]/g, (c) => {
if (c === '.') return '-';
return `z${c.charCodeAt(0)}z`;
Expand Down

0 comments on commit a796811

Please sign in to comment.