Skip to content

Update xss-example.js#93

Open
antonychiu2 wants to merge 1 commit intoSnykfrom
antonychiu2-patch-33
Open

Update xss-example.js#93
antonychiu2 wants to merge 1 commit intoSnykfrom
antonychiu2-patch-33

Conversation

@antonychiu2
Copy link
Owner

No description provided.

var unsafe_div = window.document.getElementById("vulnerable-div");
unsafe_div.innerHTML = "Hello " + name;
var unsafe_div = window.document.getElementById("vulnerable-div");
unsafe_div.innerHTML = "Hello " + name;
Copy link

@github-actions github-actions bot Aug 27, 2024

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 Snyk:

diff --git a/xss-example.js b/xss-example.js
--- a/xss-example.js
+++ b/xss-example.js
@@ -2,4 +2,4 @@
 var name = urlParams.get('name');
 
 var unsafe_div = window.document.getElementById("vulnerable-div"); 
-unsafe_div.innerHTML = "Hello " + name;  
+unsafe_div.textContent = "Hello " + name;  
 


Learn more and fine tune the fix

@github-actions
Copy link

image 1 fix is ready to be committed

XSS - 1

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.

1 participant