Skip to content

Security

Andrii Sharmar edited this page Nov 23, 2024 · 2 revisions
  • Input Data Validation: All incoming data is validated to prevent SQL/NoSQL injections, Cross-Site Scripting (XSS), and ensure data integrity. This is implemented using server-side validation checks in conjunction with frontend validation.

  • Rate Limiting: Rate limiting is implemented using the express-rate-limit package to limit the number of requests a user can make within a specific time frame, reducing the risk of brute-force attacks and ensuring the server is not overwhelmed by excessive traffic.

  • Helmet: The helmet package is used to secure the application by setting various HTTP headers, such as Content Security Policy (CSP), which prevents unauthorized scripts from running in the context of the page, protecting against Cross-Site Scripting (XSS) attacks, and other web vulnerabilities.

  • Cross-Origin Resource Sharing (CORS): The application is configured to use the cors middleware, which allows only trusted origins to access the API. This helps prevent Cross-Origin Request Forgery (CSRF) and restricts unauthorized domains from making requests to the server.

  • HTTPS Enforcement: The server is configured to enforce HTTPS, ensuring that all data exchanged between clients and the server is encrypted and protected from eavesdropping or tampering by third parties.

  • Environment Variables: Sensitive data, such as database URIs, API keys, and email service credentials, are stored in environment variables (.env file). This prevents sensitive information from being hard-coded in the source code and ensures security during deployment.

  • Error Handling: Comprehensive error handling is implemented to avoid leaking sensitive information through stack traces. Specific error messages are displayed to users, while detailed error logs are stored on the server for further analysis.

  • Data Sanitization: User inputs are sanitized to remove potentially harmful characters, ensuring that only valid data is stored in the database.

Clone this wiki locally