From the course: JavaScript: Security Essentials

Unlock this course with a free trial

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

Example of XSS in code

Example of XSS in code

- [Instructor] Let's take a look at the exercise files for an example of cross-site scripting in action with an example project. So what I'm going to do first is open from the exercise files the project that I have. And like I mentioned in the past, you can do this through Chapter 2 here. And then what we're going to do is open 02_02 right here. So you can grab the files directly from the begin at first. You can copy this, insert it into your project, and we're going to do just that. And I'm using VS Code. And this is the project here. So this is a previous project that I built into another course, and we're using this project to basically do the examples. So in the components you have the App.jsx right here. And I'm just going to close this. And inside of that file you have some bad code. So we're returning here some HTML, and, up until we render it, it's not dangerous. But what we're doing here, if you scroll down into line here, 45, you see this div here that inserts in our HTML…

Contents