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

Insufficient permissions on packages.php #26230

Closed
tom-sinclair opened this issue Oct 24, 2018 · 2 comments
Closed

Insufficient permissions on packages.php #26230

tom-sinclair opened this issue Oct 24, 2018 · 2 comments

Comments

@tom-sinclair
Copy link

  • Laravel Version: v5.7.10
  • PHP Version: 7.1
  • Database Driver & Version: MS SQL Server

Description:

When running artisan package:discover the generated bootstrap/cache/packages.php file doesn't have sufficient permissions to be opened when running the app. Reverting back to v5.7.9 works.

Steps To Reproduce:

Install v5.7.10
run php artisan package:discover
Go any URL for your application

image

@Yogarine
Copy link
Contributor

This is caused because tempnam() already creates the file with limited permissions 600.
The temp packages.php is then moved over the original, but it still has the limited permissions.

I have a proposed fix where I simply unlink() the temporary file created, so the new file written by file_put_contents() respects the current umask.

The alternatives are:

  • Don't use tempnam() but instead create a file with uniqid().
  • Change the permissions of the tempfile after creating it.

I don't like the first alternative because tempnam() is specifically made for this case, and has the added effect of actually testing whether the file can be written.

The second solution means we have to figure out the current umask to keep it consistent. Using umask() is cumbersome and not recommended on multi-threaded servers.

@barryvdh
Copy link
Contributor

I think this should be fixed with above PR, which is merged and tagged as 5.7.11

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