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

Running php artisan optimize breaks CSRF token validation. #3134

Closed
luke-navitas opened this issue Jan 25, 2022 · 2 comments
Closed

Running php artisan optimize breaks CSRF token validation. #3134

luke-navitas opened this issue Jan 25, 2022 · 2 comments

Comments

@luke-navitas
Copy link

luke-navitas commented Jan 25, 2022

Description:

If I use the workspace container and run php artisan optimize
I get errors in any application AJAX request, CSRF token mismatch.

Illuminate\Session\TokenMismatchException is thrown.

Expected Behavior:

CSRF Token is valid and AJAX request is permited.

Context information:

Output of git rev-parse HEAD

~/laradock (master ✔) ᐅ git rev-parse HEAD
3212d5e9684bd811b4825cad238acf3ff71ba781

Output of docker version

~/laradock (master ✔) ᐅ docker version
Client: Docker Engine - Community
 Version:           20.10.10
 API version:       1.41
 Go version:        go1.16.9
 Git commit:        b485636
 Built:             Mon Oct 25 07:42:59 2021
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.10
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.16.9
  Git commit:       e2f740d
  Built:            Mon Oct 25 07:41:08 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.11
  GitCommit:        5b46e404f6b9f661a205e28d59c982d3634148f8
 runc:
  Version:          1.0.2
  GitCommit:        v1.0.2-0-g52b36a2
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Output of docker-compose version

~/laradock (master ✔) ᐅ docker-compose version  
Docker Compose version v2.0.1

System info: Mac, Windows or Linux. Include which disto/version

Distributor ID: Ubuntu
Description:    Ubuntu 20.04.3 LTS

Steps to reproduce the issue:

Run commands
1. docker-compose exec workspace bash`
2. cd app
3. php artisan optimize

Make AJAX request in application, with CSRF token.

Stacktrace & Additional info:

I suspect the config cache file is unreadable, as its owned by root.

root@03261a3709bc:/var/www/app/bootstrap/cache# ls -al
total 1420
drwxrwxrwx 2     1012     1013    4096 Jan 25 14:54 .
drwxrwxr-x 3     1012     1013    4096 Oct 28 09:28 ..
-rw-r--r-- 1 root     root       69970 Jan 25 14:54 config.php
-rwxrwxrwx 1     1012     1013      14 Oct 28 09:28 .gitignore
-rwxr-xr-x 1 laradock laradock    3390 Jan 25 14:54 packages.php
-rw-r--r-- 1 root     root     1346487 Jan 25 14:54 routes.php
-rwxr-xr-x 1 laradock laradock   16208 Jan 25 14:54 services.php

BROKEN ^
@stale
Copy link

stale bot commented Apr 27, 2022

Hi 👋 this issue has been automatically marked as stale 📌 because it has not had recent activity 😴. It will be closed if no further activity occurs. Thank you for your contributions ❤️.

@stale stale bot added the Stale label Apr 27, 2022
@stale
Copy link

stale bot commented Jun 12, 2022

Hi again 👋 we would like to inform you that this issue has been automatically closed 🔒 because it had not recent activity during the stale period. We really really appreciate your contributions, and looking forward for more in the future 🎈.

@stale stale bot closed this as completed Jun 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant