Skip to content

Conversation

@bvdputte
Copy link

Please first update mzur/kirby-form dependency with mzur/kirby-form#16

Afterwards, with this PR we should be able to bypass CSRF for headless form validation.

Also see: https://forum.getkirby.com/t/uniform-deactivate-csrf-check-for-headless-usecases/20643

Thanks! 🙌

Copy link
Owner

@mzur mzur left a comment

Choose a reason for hiding this comment

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

Thanks! I made suggestions for alternative method/variable names. Also, please add a test case for this. You could take the code of testValidateCsrfException(), remove the expectException() and add the new disableCsrfProtection().

}
```

## withoutCSRF()
Copy link
Owner

Choose a reason for hiding this comment

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

I'd like to call this disableCsrfProtection() to make sure that you are disabling an important protection mechanism.

*
* @var boolean
*/
protected $shouldValidateCSRF;
Copy link
Owner

Choose a reason for hiding this comment

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

Please rename to $shouldValidateCsrfToken.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants