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

Set allow_url_fopen=0 by default #39

Closed
wants to merge 3 commits into from
Closed

Conversation

KTanAug21
Copy link
Contributor

WHAT AND WHY:
Disable PHP setting allow_url_fopen by default. Include a Dockerfile ENV variable called "PHP_ALLOW_URL_FOPEN" to turn this on ( 1 ) or off( 0 ).

allow_url_fopen has some traces of evil in it, since: it can allow remote code execution. So by default, as suggested by a Fly community member in an email, we disable it for Fly Laravel apps. Of course, there maybe cases that a user may want this setting turned on, hence the ENV variable provided!

HOW
For Laravel apps set to be deployed to Fly.io, create a new remote-file-access.conf template that sets the value of allow_url_fopen based on the value of "PHP_ALLOW_URL_FOPEN" variable. Copy this over to the /etc/php/${PHP_VERSION}/fpm/pool.d for it to be read.

…ust retain flag to set allow_url_fopen off
@KTanAug21
Copy link
Contributor Author

Might need to close this if fly-apps/laravel-docker#12 from laravel-docker is pushed( the PR contains the flag for setting allow_url_fopen value

@kzys
Copy link

kzys commented May 30, 2024

Does this PR work without fly-apps/laravel-docker#12? Does PHP itself read the environment variable?

@KTanAug21
Copy link
Contributor Author

Does this PR work without fly-apps/laravel-docker#12? Does PHP itself read the environment variable?

Hi @kzys ! Nope. The reason for adding the flag in the Dockerfile generated is so that it would contain the flag visibly.
Some benefits:
->This way, users will be able to easily see that it can be turned off/on.
->This way, if users actually want it turned on, and expect it to be on (since that's the default value), they'll find that it's actually off! And can immediately set it back on.

@KTanAug21
Copy link
Contributor Author

Not needed anymore as it is already set up in laravel-docker fly-apps/laravel-docker#12

@KTanAug21 KTanAug21 closed this Jun 23, 2024
@KTanAug21 KTanAug21 deleted the disable_allow_url_fopen branch June 23, 2024 15:49
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

Successfully merging this pull request may close these issues.

2 participants