Help | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
22nd Oct 2023, 12:25 PM
Aweneg Rooney
Aweneg Rooney - avatar
5 Answers
+ 2
Where? Describe the error precisely.
22nd Oct 2023, 12:34 PM
Lisa
Lisa - avatar
+ 2
👉 Describe the error. What happened? Where did you run the code? What does the error message say?
22nd Oct 2023, 12:46 PM
Lisa
Lisa - avatar
0
In the code
22nd Oct 2023, 12:36 PM
Aweneg Rooney
Aweneg Rooney - avatar
0
Code seems working fine... Where is error?
22nd Oct 2023, 3:35 PM
JaP
JaP - avatar
0
Your code is vulnerable to HTML injection and rendering issues. For example if you type in the input `<p> Hello World </p>` In the page it will show Hello world. Here is a better example: typing <button> </button> to the code will make a button. By directly inserting user input as HTML content, HTML injections are possible since the input is HTML content. The updated code addresses these weak points by using `textContent` to safely render user input as plain text, preventing HTML injection and XSS attacks. While this isn't necessary in a small project just for fun, if your creating huge projects you should make sure there isn't vulnerabilities like the one I stated. Here is my version of your code: https://www.sololearn.com/compiler-playground/Wzn6lKbNKHdI I only changed the content inside the Script tag
23rd Oct 2023, 11:46 AM
Coderwe2
Coderwe2 - avatar