/frontend-security-basics

The CSRF Example Application is a React-based project designed to educate users about Cross-Site Request Forgery (CSRF) attacks. This application provides an interactive way to understand CSRF concepts, how attacks work, their effects, and prevention techniques. Users can also test inputs to see how unsafe and sanitized outputs differ.

Primary LanguageJavaScript

CSRF Example Application ๐Ÿšซ๐Ÿ’ป

Demo ๐ŸŒ

frontend-security-basics

Overview

The CSRF Example Application is a React-based project designed to educate users about Cross-Site Request Forgery (CSRF) attacks. This application provides an interactive way to understand CSRF concepts, how attacks work, their effects, and prevention techniques. Users can also test inputs to see how unsafe and sanitized outputs differ.

Features

  • Interactive Learning ๐Ÿ“š: Understand the basics of CSRF through a sidebar that lists key information.
  • Input Testing ๐Ÿ–ฅ๏ธ: Users can input text to see examples of unsafe and safe output.
  • Input Sanitization ๐Ÿ”’: Demonstrates the use of DOMPurify to protect against potential XSS vulnerabilities.

Technologies Used

  • React โš›๏ธ: Frontend framework for building the user interface.
  • DOMPurify ๐Ÿงผ: A library for sanitizing HTML to prevent XSS attacks.
  • Tailwind CSS ๐ŸŽจ: Styling to enhance the user experience.

Getting Started

Prerequisites

  • Install Node.js โš™๏ธ
  • Clone the repo ๐Ÿ”„

Installation

  1. Clone the repository:
 git clone https://github.com/ertugrulsertaslan/frontend-security-basics.git
  1. Navigate to the project directory:
 cd frontend-security-basics

3.Install the dependencies:

 npm install

Running the Application

  1. Start the development server:
 npm run dev
  1. Open your browser and go to http://localhost:3000 to view the application.

Understanding CSRF

  1. ๐Ÿ“ What is CSRF?: An attack that tricks a user into executing unwanted actions without their consent.
  2. โœ… How It Works: Attacks utilize the user's authentication to perform actions on their behalf.
  3. ๐Ÿ“ง Effects: Can lead to data manipulation, unauthorized fund transfers, or changes to account settings.
  4. ๐Ÿ”’ Prevention: Use anti-CSRF tokens, SameSite cookies, and secure headers to mitigate risks.
  5. ๐Ÿ“‹ Best Practices: Always validate user actions and implement user confirmation for sensitive actions.

License ๐Ÿ“„

MIT