From 435a7d56cb551dbcd45c6c518c5e5231c90b30b0 Mon Sep 17 00:00:00 2001 From: mkhanas <87975887+mkhanas@users.noreply.github.com> Date: Sun, 2 Nov 2025 10:53:27 +0200 Subject: [PATCH 01/33] Update Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.md Extended core guidance to mention Fetch Metadata request headers (Sec-Fetch-*) as an alternative to CSRF tokens for state-changing requests. Added clarification that developers can use CSRF tokens or Fetch Metadata depending on project needs and client compatibility. Updated Fetch Metadata positionaing --- ..._Request_Forgery_Prevention_Cheat_Sheet.md | 94 ++++++++++++++++++- 1 file changed, 93 insertions(+), 1 deletion(-) diff --git a/cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.md b/cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.md index 17bae843ea..1d733f61dc 100644 --- a/cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.md +++ b/cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.md @@ -14,7 +14,8 @@ In short, the following principles should be followed to defend against CSRF: - **See the OWASP [XSS Prevention Cheat Sheet](Cross_Site_Scripting_Prevention_Cheat_Sheet.md) for detailed guidance on how to prevent XSS flaws.** - **First, check if your framework has [built-in CSRF protection](#use-built-in-or-existing-csrf-implementations-for-csrf-protection) and use it** -- **If the framework does not have built-in CSRF protection, add [CSRF tokens](#token-based-mitigation) to all state changing requests (requests that cause actions on the site) and validate them on the backend** +- **If the framework does not have built-in CSRF protection, add [CSRF tokens](#token-based-mitigation) to all state changing requests (requests that cause actions on the site) and validate them on the backend, or validate [Fetch Metadata headers](#fetch-metadata-headers) on the backend for all state-changing requests.** +- **If your software is intended to be used only on modern browsers, you may rely primarily on [Fetch Metadata headers](#fetch-metadata-headers) to block cross-site state-changing requests** - **Stateful software should use the [synchronizer token pattern](#synchronizer-token-pattern)** - **Stateless software should use [double submit cookies](#alternative-using-a-double-submit-cookie-pattern)** - **If an API-driven site can't use `