Support the ongoing development of Laravel.io →
Requests Database Packages
Last updated 1 year ago.
0

I think the csrf was enabled by default on on post routes.

I don't know of any way to bypass the auto csrf check, you could try something like this to exclude the posts.

Quick and freehand dirty ... (aka untested)

Route::filter('csrf', function()
{

	// bypass route names (could move to a config file)
	$tmpStr = array('credits.ipn', 'credits.success');

	//bypass on these routes
	$routename = Route::currentRouteName();
	
	if (!in_array($routename, $tmpStr)) {

		if (Session::token() !== Input::get('_token'))
		{
			throw new Illuminate\Session\TokenMismatchException;
		}

	}

});

Another option would be to just clear out the default csrf filter and make your own, the auto check wouldn't have anything to fail on, ...

Changing the default filter,

Route::filter('csrf', function()
{
	if (Session::token() !== Input::get('_token'))
	{
		throw new Illuminate\Session\TokenMismatchException;
	}
});

to

Route::filter('csrf', function()
{
	// no auto check on posts
});

Route::filter('mycsrf', function()
{
	if (Session::token() !== Input::get('_token'))
	{
		throw new Illuminate\Session\TokenMismatchException;
	}
});

Then you can add in the mycsrf to any routes you want it to be on.

Just a couple thoughts, hope they help.

0

Just by taking my IPN routes out of the "before auth" group, it seems to be working fine now?

That's cool about the csrf though, think I'll implement that anyway, thanks! :)

0

PayumLaravelPackage supports Paypal IPN out of the box, with even some additional security checks. Just setup the package, configure it and use, it'll do the rest.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

ncovill ncovill Joined 12 Jan 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.