Skip to content

Update xss-example.js#2

Open
eitanMobb wants to merge 1 commit into
mainfrom
eitanMobb-patch-1
Open

Update xss-example.js#2
eitanMobb wants to merge 1 commit into
mainfrom
eitanMobb-patch-1

Conversation

@eitanMobb

Copy link
Copy Markdown
Owner

No description provided.

Comment thread xss-example.js
var unsafe_div = window.document.getElementById("vulnerable-div");
unsafe_div.innerHTML = "Hello to you ";

unsafe_div.innerHTML = "Hello to you " + username;

Check failure

Code scanning / CodeQL

Client-side cross-site scripting

Cross-site scripting vulnerability due to [user-provided value](1).
@github-actions

Copy link
Copy Markdown

image 1 fix is ready to be committed

XSS - 1

Comment thread xss-example.js
var unsafe_div = window.document.getElementById("vulnerable-div");
unsafe_div.innerHTML = "Hello to you ";

unsafe_div.innerHTML = "Hello to you " + username;

@github-actions github-actions Bot May 29, 2024

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

image XSS fix is ready

Apply the following code change to fix XSS issue detected by CodeQL:

--- a/xss-example.js
+++ b/xss-example.js
@@ -5,4 +5,4 @@
 
 var unsafe_div = window.document.getElementById("vulnerable-div");
 
-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