Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to re enable csrf ? #198

Closed
bmpf opened this issue Sep 11, 2019 · 7 comments
Closed

How to re enable csrf ? #198

bmpf opened this issue Sep 11, 2019 · 7 comments

Comments

@bmpf
Copy link

bmpf commented Sep 11, 2019

How can i re enable csrf ?

I already uncommented the lines in the App\Http\Kernel but I still can make post requests with postman without the csrf field in the header.

@bmpf
Copy link
Author

bmpf commented Sep 11, 2019

I think this ll solve it maybe :/ ?

'api' => [
'throttle:60,1',
'bindings',
\Illuminate\Session\Middleware\StartSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
],

@cretueusebiu
Copy link
Owner

You don't have to use a csrf token with this template because it uses a token when making a request to the server.

@bmpf
Copy link
Author

bmpf commented Sep 12, 2019

I have a couple of forms that you dont need to be logged in order to send them. I can 'abuse' them via script or postman with constant fake posts requests.
All I put in the headers are the Accept Key. And nothing else.
image

@bmpf
Copy link
Author

bmpf commented Sep 12, 2019

is there a guest Bearer ?

@cretueusebiu
Copy link
Owner

I think you can enable back all the middleware.
I've disabled them because it as it is now you don't need them.
But if you have some other pages where you need csrf token, you can enable all of them back.

@bmpf
Copy link
Author

bmpf commented Sep 12, 2019

How can i enable them back ?

01 - I already uncommented the lines in the App\Http\Kernel

image

02 - Added the meta to index.blade.php header <meta name="csrf-token" content="{{ csrf_token() }}">

image

03 - The cookies are being sent with the form :
image

04 - The X-XSRF-TOKEN too :
image

But I can still make fake requests with postman . In other words , the csrf token its not validated :/
Did you disable something else ?
image
image

@bmpf
Copy link
Author

bmpf commented Sep 12, 2019

I think I ll use something like google recaptcha

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

No branches or pull requests

2 participants