Skip to content

Add a page on CSRF#38151

Merged
wbamberg merged 28 commits intomdn:mainfrom
wbamberg:add-csrf-attack
Mar 21, 2025
Merged

Add a page on CSRF#38151
wbamberg merged 28 commits intomdn:mainfrom
wbamberg:add-csrf-attack

Conversation

@wbamberg
Copy link
Copy Markdown
Collaborator

@wbamberg wbamberg commented Feb 14, 2025

This PR adds a page on CSRF attacks.

It's potentially a replacement for https://developer.mozilla.org/en-US/docs/Web/Security/Practical_implementation_guides/CSRF_prevention, and compared with that page:

  • explains in more concrete terms what a CSRF attack is and how it works
  • describes an alternative defense
  • describes in a bit more detail about the limitations of SameSite

@github-actions github-actions bot added Content:Security Security docs size/m [PR only] 51-500 LoC changed labels Feb 14, 2025
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 14, 2025

Preview URLs

External URLs (6)

URL: /en-US/docs/Web/Security/Attacks/CSRF
Title: Cross-site request forgery (CSRF)

(comment last updated: 2025-03-12 21:30:24)

@wbamberg wbamberg marked this pull request as ready for review February 14, 2025 19:28
@wbamberg wbamberg requested a review from a team as a code owner February 14, 2025 19:28
@wbamberg wbamberg requested review from chrisdavidmills and hamishwillee and removed request for a team February 14, 2025 19:28
Copy link
Copy Markdown
Contributor

@mozfreddyb mozfreddyb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really love this article. I found some nits and have a somewhat positive take on fetch metadata header such that I would argue to include them.

wbamberg and others added 3 commits March 12, 2025 14:28
Co-authored-by: Frederik Braun <fbraun+gh@mozilla.com>
Co-authored-by: Frederik Braun <fbraun+gh@mozilla.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 17, 2025

Preview URLs

Flaws (3)

Note! 1 document with no flaws that don't need to be listed. 🎉

URL: /en-US/docs/Web/Security/Attacks/CSRF
Title: Cross-site request forgery (CSRF)
Flaw count: 3

  • broken_links:
    • /en-US/docs/Web/HTTP/CORS#simple_requests is a redirect
    • /en-US/docs/Web/HTTP/CORS is a redirect
    • /en-US/docs/Web/HTTP/Headers/Set-Cookie#samesitesamesite-value is a redirect
External URLs (6)

URL: /en-US/docs/Web/Security/Attacks/CSRF
Title: Cross-site request forgery (CSRF)

(comment last updated: 2025-03-21 01:12:41)

@wbamberg
Copy link
Copy Markdown
Collaborator Author

@mozfreddyb , I have attempted to address your comments. @hamishwillee you might also want a look to see if it still makes sense!

@mozfreddyb
Copy link
Copy Markdown
Contributor

This looks much better now imho :-) For some reason I can't "resolve" comments that I supplied, maybe because I'm not a reviewer from within the mdn content project. I can do another review in the coming days, but it would help if you could resolve those that you consider fixed for us both to keep track of changes.

Copy link
Copy Markdown
Contributor

@mozfreddyb mozfreddyb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't formally approve: Only users with explicit access to this repository may approve pull requests.

But I approve of this anyway. 😁

Co-authored-by: Hamish Willee <hamishwillee@gmail.com>
@hamishwillee
Copy link
Copy Markdown
Collaborator

Still looks good to me. A couple of comments, but it is still approved (great to have the feedback from @mozfreddyb ).

wbamberg and others added 2 commits March 20, 2025 17:21
Co-authored-by: Hamish Willee <hamishwillee@gmail.com>
Co-authored-by: Hamish Willee <hamishwillee@gmail.com>
@wbamberg wbamberg merged commit 64fd738 into mdn:main Mar 21, 2025
8 checks passed
@mozfreddyb
Copy link
Copy Markdown
Contributor

In light of this merging, should https://developer.mozilla.org/en-US/docs/Web/Security/Practical_implementation_guides/CSRF_prevention be removed? I'd lean to yes. This here was written as a replacement to it after all.

I think https://developer.mozilla.org/en-US/docs/Glossary/CSRF should link to the new article as well.

@mozfreddyb
Copy link
Copy Markdown
Contributor

@wbamberg
Copy link
Copy Markdown
Collaborator Author

Yes, I'm eventually going to get around to cleaning all that up!

wbamberg added a commit to wbamberg/content that referenced this pull request Apr 4, 2025
* upstream/main: (172 commits)
  chore: improve code style guide (mdn#38715)
  fix: typo on `Error.isError()` page (mdn#38754)
  plural consistency (mdn#38747)
  fix: auto-cleanup by bot (mdn#38695)
  Synchronize with BCD v5.7.4 (mdn#38709)
  Add docs for JS self-profiling API (mdn#37796)
  Better SameSite docs (mdn#38710)
  Added missing explanation for Array Literals (mdn#38745)
  Add a page on CSRF (mdn#38151)
  Fix description of several Range methods (mdn#38518)
  Remove extraneous span (mdn#38696)
  Add a definition for media containers, improve how the media files are defined and Remove wrong information (mdn#38721)
  Move visited selector guide to CSS selectors module (mdn#38642)
  Make JSON learning article more technically precise (mdn#38644)
  Make translate3d() interactive example code valid (mdn#38647)
  Clarity on Safari support for custom elements (mdn#38727)
  feat(css): Link to learning doc about text direction (mdn#38719)
  Fix typo (mdn#38739)
  move guide to module: inline formatting context (mdn#38637)
  Fix CSS pseudo-class lists (mdn#38576)
  ...
cssinate pushed a commit to cssinate/content that referenced this pull request Apr 11, 2025
* Add a page on CSRF

* Update landing page

* ...

* fix glossary macros

* Bits and pieces

* typo

* correct words

* simpler example

* undo simpler example

* Update files/en-us/web/security/attacks/csrf/index.md

Co-authored-by: Hamish Willee <hamishwillee@gmail.com>

* Update files/en-us/web/security/attacks/csrf/index.md

Co-authored-by: Hamish Willee <hamishwillee@gmail.com>

* Update files/en-us/web/security/attacks/index.md

Co-authored-by: Hamish Willee <hamishwillee@gmail.com>

* Review comments

* Expand on SameSite problems

* Add defense summary checklist

* Update files/en-us/web/security/attacks/csrf/index.md

* Update files/en-us/web/security/attacks/csrf/index.md

Co-authored-by: Hamish Willee <hamishwillee@gmail.com>

* Update files/en-us/web/security/attacks/csrf/index.md

Co-authored-by: Frederik Braun <fbraun+gh@mozilla.com>

* Update files/en-us/web/security/attacks/csrf/index.md

Co-authored-by: Frederik Braun <fbraun+gh@mozilla.com>

* Shorten section on CORS

* Use form submission as an example of top-level navigation

* Recommend using both Lax and Strict

* Add a bit on Fetch metadata

* Better link for SameSite

* Update files/en-us/web/security/attacks/csrf/index.md

Co-authored-by: Hamish Willee <hamishwillee@gmail.com>

* Update files/en-us/web/security/attacks/csrf/index.md

* Update files/en-us/web/security/attacks/csrf/index.md

Co-authored-by: Hamish Willee <hamishwillee@gmail.com>

* Update files/en-us/web/security/attacks/csrf/index.md

Co-authored-by: Hamish Willee <hamishwillee@gmail.com>

---------

Co-authored-by: Hamish Willee <hamishwillee@gmail.com>
Co-authored-by: Frederik Braun <fbraun+gh@mozilla.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Content:Security Security docs size/m [PR only] 51-500 LoC changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants