Closed iblancasa closed 7 years ago
Learn new things. Thanks @iblancasa
Why this change was not accepted?
@iblancasa why i keep getting undefined data when i want to send the message
Oh!
Probably would be a nice idea to add an if
to check if the message is undefined. In this case, do nothing.
@iblancasa As far as i know, striptags function is to remove tags. For example remove html tags. how come it can prevent injection. Striptags correct me if im wrong.
If I understood properly, you are asking how this package prevents the HTML injection, right?
Striptags will remove the HTML tags. If you remove the HTML tags from the messages sent by the clients, these tags will not be in the message and these tags will not be injected.
You can connect to your chat and send this message:
<img src="https://media.npr.org/assets/img/2014/05/08/simp2006_homerarmscrossed_f_wide-f5b7cb17067fc89225d72d768a00dc0a9cf2545c.jpg">
Imagine that, instead add one image, this script will add a malicious Javascript.
Now, you can add this code to the text input:
And the image will be shown. This PR prevents HTML and JavaScript injections.