Skip to content

Commit

Permalink
fix: Update profile page to use JSON.stringify for username to preven…
Browse files Browse the repository at this point in the history
…t XSS

Modified the EJS template to use JSON.stringify for embedding the username to prevent cross-site scripting (XSS) vulnerabilities.
  • Loading branch information
TKanX committed Aug 6, 2024
1 parent 0f115d2 commit 9952175
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion views/pages/users/profile.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
// Add event listener to window load
window.addEventListener("DOMContentLoaded", async () => {
// Set the username
const username = encodeURIComponent("<%- username %>");
const username = "<%= JSON.stringify(username) %>";
// New users instance
const users = new Users(username);
Expand Down

0 comments on commit 9952175

Please sign in to comment.