Skip to content

Update xss-example.js#1

Open
mobbjon wants to merge 8 commits intomainfrom
introduce-new-security-issue
Open

Update xss-example.js#1
mobbjon wants to merge 8 commits intomainfrom
introduce-new-security-issue

Conversation

@mobbjon
Copy link
Owner

@mobbjon mobbjon commented Jan 18, 2024

No description provided.

Repository owner deleted a comment from github-actions bot Jan 25, 2024
@github-actions github-actions bot deleted a comment from mobbjon Jan 25, 2024
xss-example.js Outdated
var unsafe_div = window.document.getElementById("vulnerable-div");
unsafe_div.innerHTML = "Hello to you ";
// here's an XSS:
unsafe_div.innerHTML = "Hello to you " + username;
Copy link
Owner Author

@mobbjon mobbjon Jan 25, 2024

Choose a reason for hiding this comment

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

image XSS fix has been committed ✅

--- a/xss-example.js
+++ b/xss-example.js
@@ -5,4 +5,4 @@
 
 var unsafe_div = window.document.getElementById("vulnerable-div");
 // here's an XSS:
-unsafe_div.innerHTML = "Hello to you " + username;
+unsafe_div.textContent = "Hello to you " + username;
 

Learn more and fine tune the fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants