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

smarty does not respect umask, but uses hard-coded permissions. #819

Closed
Nimloth opened this issue Oct 3, 2022 · 1 comment · Fixed by #828
Closed

smarty does not respect umask, but uses hard-coded permissions. #819

Nimloth opened this issue Oct 3, 2022 · 1 comment · Fixed by #828

Comments

@Nimloth
Copy link

Nimloth commented Oct 3, 2022

I don't know about other distros, but on FreeBSD, the init script for php-fpm allows setting umask.
We usually set it to 027 as each php-fpm pool will run under its own user, one pool per website being hosted.
None of those websites' dirs or files need (or indeed should) to be readable by others (at all).

Anyway, while php's file operations respect umask, smarty does not.
Even in the case mentioned above (explicitly run php-fpm with umask of 027), both compiled template files and cache files will be created with permission 644.

From my POV, smarty should not impose its own assumptions on users.
Just using stuff like file_put_contents or fopen do respect umask, so I do not see why smarty needs permissions to be hardcoded like thus:

See also
#507
for discussion around the whole topic. (Personally, I do not consider 'use ACLs for that sort of thing' as an adequate response, but YMMV.)

@janis-ps
Copy link

Agreed. Just found out from the PR linked above that $smarty->_file_perms was removed, which actually makes the situation worse. So, umask has no effect, and _file_perms doesn't exist anymore. If you require custom permissions, too bad - you're stuck with 0644.

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 a pull request may close this issue.

2 participants