110

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 7.1 or higher

Installation

Composer:

composer require vdlp/oc-csrf-plugin

CLI:

php artisan plugin:install Vdlp.Csrf

October CMS:

Go to Settings > Updates & Plugins > Install plugins and search for 'CSRF'.

Configuration

Add the plugin configuration to your projects' config folder:

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

Add the CSRF token to the head:

<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. You can also visit the support forum and drop your questions/issues there.

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