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

Csrf does not work unless unit test are run #49000

Closed
jcrangon opened this issue Nov 14, 2023 · 5 comments
Closed

Csrf does not work unless unit test are run #49000

jcrangon opened this issue Nov 14, 2023 · 5 comments

Comments

@jcrangon
Copy link

jcrangon commented Nov 14, 2023

Laravel Version

Latest

PHP Version

8.2.10

Database Driver & Version

Mariadb 10.24

Description

Csrf check using sanctum endpoint will not work unless i modify this in vendor/laravel/framework/sec/illuminate/fondation/http/middleware/VerifyCsrfToken.php
I added a ! On Line this->runningTestUnit

Screenshot_2023-11-14-12-44-03-57_f541918c7893c52dbd1ee5d319333948

Steps To Reproduce

None

@jcrangon jcrangon changed the title Csrf dors not work unless unit test are run Csrf does not work unless unit test are run Nov 14, 2023
@bennofication
Copy link

Are you using Axios on your front end to make requests? If so check the Axios version you are using. If it is >= 1.6.0 the issue might be that Axios fixed a CVE which resulted in them no longer reading the XSRF-TOKEN cookie set by Sanctum and therefore the X-XSRF-TOKEN header is missing on your post requests which would be read by your VerifyCsrfToken middleware.

@driesvints
Copy link
Member

Hi there,

Thanks for reporting but it looks like this is a question which can be asked on a support channel. Please only use this issue tracker for reporting bugs with the library itself. If you have a question on how to use functionality provided by this repo you can try one of the following channels:

However, this issue will not be locked and everyone is still free to discuss solutions to your problem!

Thanks.

@jcrangon
Copy link
Author

jcrangon commented Nov 14, 2023 via email

@jcrangon
Copy link
Author

jcrangon commented Nov 14, 2023 via email

@jcrangon
Copy link
Author

Hello!! update: I tested with axios 1.6.2. which did not solve the problem... you have any news bout this issue?

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

4 participants