Skip to content

Update xss-example.js#1

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

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

Conversation

@mobbjon

@mobbjon mobbjon commented Jan 18, 2024

Copy link
Copy Markdown
Owner

No description provided.

Comment thread xss-example.js Fixed
Comment thread xss-example.js
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
Comment thread xss-example.js
Comment thread xss-example.js
Comment thread 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;

@mobbjon mobbjon Jan 25, 2024

Copy link
Copy Markdown
Owner Author

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.

3 participants