Problem/Motivation
From the DrupalCon Barcelona Hard Problems Meeting on performance:
Wim: GET forms shouldn't have CSRF tokens — https://www.drupal.org/node/2571995
Alex: I have a use case
Crell: CSRF token in the URL is a bad thing, just like a session ID in there is a bad thing
Crell: we should make it an opt-in thing (i.e. default GET forms to #token = FALSE)
Alex: Oh, now I realized that I actually don't have a use case, we found that to be wrong.
Catch: we should verify that it actually offers any protection, if it’s not, then we should not even make it opt-in, we should make it impossible, and document it
So, step 1 is #2571995: GET forms shouldn't have CSRF tokens by default, this is step 2.
Proposed resolution
Prevent GET forms from ever having a CSRF token.
Remaining tasks
- Investigate
- If conclusion supports our hypothesis, implement
User interface changes
None.
API changes
None.
Data model changes
None.
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | 2575429-11.patch | 2.67 KB | Danny.Wouters |
| #11 | interdiff-2575429-4-11.txt | 1.65 KB | Danny.Wouters |
Issue fork drupal-2575429
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
catchSo one thing to double check here would be whether there's a difference between submitting the form and just visiting the URL - i.e. what happens with validate/submit handlers in those cases.
Comment #3
borisson_Now that #2571995: GET forms shouldn't have CSRF tokens by default is in, this is no longer postponed.
Comment #4
wim leersNo patch yet, so setting to .
Comment #5
kylebrowning commentedSO im not sure I understand why this wasn't done in the first place, but heres the first run at a patch, and probably will fail tests.
Comment #6
wim leersEh… isn't this going to remove CSRF tokens for all forms? :P
Comment #7
kylebrowning commentedNo because its inside this,
Comment #10
Danny.Wouters commentedI will try to find a solution.
Comment #11
Danny.Wouters commentedI added extra checks on the form method.
Comment #13
Danny.Wouters commentedComment #15
joachim commentedSearch module has to do hook_form_alter() on its own form because of this, so that can be cleaned up as part of this:
Should removing the form_id and form_build_id be handled in this issue too, or as a follow-up?
Comment #30
quietone commented