From the course: JavaScript: Security Essentials

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Final syntax applied XSS

Final syntax applied XSS

- [Instructor] Okay, so let's take a look at some information on cross site scripting. How you would fix this, some cheat sheets on owasp. So, let's go ahead and take a look at this. So, the first thing is how do we fix this directly in React or this JavaScript here? As it concerns React, you would basically pass that title into your state and then render it here. So, that's the safest way. There used to be a technique where you could use a prop called dangerously set inner HTML, and then you could actually render it this way. But this doesn't work anymore. The browser and also React actually sanitizes this. So, let's go ahead and just do this. Perfect. So, let's take a look at some information on owasp. So, go to owasp.org. And then I would ask you to search for cross site scripting. And then select the first one and then scroll down until you see cross site scripting prevention cheat sheet. There's also the DOM based XSS prevention cheat sheet, which is also good. So, let's open…

Contents