87

Product support

Visit this product's website for support.

Categories

Vdlp.CSRF

General

Cross-Site Request Forgery (CSRF) is an attack that forces an end user to execute unwanted actions on a web application in which they're currently authenticated. CSRF attacks specifically target state-changing requests, not theft of data, since the attacker has no way to see the response to the forged request. With a little help of social engineering (such as sending a link via email or chat), an attacker may trick the users of a web application into executing actions of the attacker's choosing. If the victim is a normal user, a successful CSRF attack can force the user to perform state changing requests like transferring funds, changing their email address, and so forth. If the victim is an administrative account, CSRF can compromise the entire web application.

Read more on: https://www.owasp.org/index.php/Cross-Site_Request_Forgery_(CSRF)

Requirements

  • PHP 8.0.2 or higher
  • October CMS 2.0 or higher

Installation

composer require vdlp/oc-csrf-plugin

Configuration

Add the plugin configuration to your config folder:

php artisan vendor:publish --provider="Vdlp\Csrf\ServiceProviders\CsrfServiceProvider" --tag="vdlp-csrf-config"

Add the CSRF token to the <head> section:

<meta name="csrf-token" content="{{ csrf_token() }}">

Add the CSRF token to the AJAX requests:

<script type="text/javascript">
$.ajaxSetup({
    headers: {
        'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
    }
});
</script>

Questions? Need help?

If you have any question about how to use this plugin, please don't hesitate to contact us at octobercms@vdlp.nl. We're happy to help you.

2.1.1

Add missing composer repository

Oct 28, 2022

2.1.0

Add support for October CMS 3.x

Oct 28, 2022

2.0.4

Maintenance release

Mar 08, 2022

2.0.3

Fixes type error when using `csrf_token()` Twig function

Sep 24, 2021

2.0.2

Minor improvements -- See: CHANGELOG.md

Sep 14, 2021

2.0.1

Fix location of plugin config.php file

Aug 05, 2021

2.0.0

Support for PHP 7.4 or higher

Jul 13, 2021

1.1.2

Update plugin dependencies

May 28, 2021

1.1.1

Prevent error on CSRF token conversion -- See: https://github.com/vdlp/oc-csrf-plugin/releases/tag/1.1.1

Jun 08, 2020

1.1.0

Added configuration to exclude paths from CSRF validation -- See: https://github.com/vdlp/oc-csrf-plugin/releases/tag/1.1.0

Oct 09, 2019

1.0.0

First version of Vdlp.Csrf -- See: https://github.com/vdlp/oc-csrf-plugin/releases/tag/1.0.0

Oct 09, 2019