/xss-example

Simple example how XSS working and how to prevent this type of attacks

Primary LanguageHTML

XSS Attack and prevention

This is a simple example project that demonstrates how Cross-Site Scripting (XSS) works and how to prevent this type of attack. The project uses pure JavaScript, HTML, and Tailwind CSS.

Installation

  1. Clone the repository to your local machine using git clone command or by downloading the ZIP file from the repository.

  2. Setup project and run development server

Download Node.js. Run this followed commands:

With yarn

# Install dependencies (only the first time)
yarn

# Run the local server at localhost:5173
yarn dev

With NPM

# Install dependencies (only the first time)
npm install

# Run the local server at localhost:5173
npm run dev

Usage

  1. Launch the project in your web browser.
  2. Follow the instructions in xss.js to understand how XSS attacks work and how they can be prevented.
  3. Experiment with different types of XSS attacks and see the countermeasures in action.
  4. Explore the code in the index.html and xss.js files to understand the implementation of the XSS prevention techniques using pure JavaScript.

Contributing

If you would like to contribute to this project, please fork the repository, make your changes, and submit a pull request.

License

This project is open-source and available under the MIT License.

Credits

This project was created by Bohdan Ly. Feel free to contact me at bohdan.lysh@gmail.com for any questions or feedback.

Enjoy exploring and learning about XSS attacks and their prevention in this example project!