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

chmod issues #19

Open
orlitzky opened this issue Jan 25, 2023 · 0 comments
Open

chmod issues #19

orlitzky opened this issue Jan 25, 2023 · 0 comments

Comments

@orlitzky
Copy link

Hello, I've encountered two issues with the way directory permissions are handled. The code (repeated twice) looks like,

if ( ! defined( 'FS_CHMOD_DIR' ) ) {
  define( 'FS_CHMOD_DIR', ( 0755 & ~ umask() ) );
}

// If the fonts folder don't exist, create it.
if ( ! file_exists( $this->get_fonts_folder() ) ) {
  $this->get_filesystem()->mkdir( $this->get_fonts_folder(), FS_CHMOD_DIR );
}

There are two problems, but the second subsumes the first, so I'll start with the easy one:

  1. I don't think it's right to use the global constant FS_CHMOD_DIR as what is essentially a temporary variable here. If some other code calls these public functions, then FS_CHMOD_DIR will become defined globally, and will affect the permissions of any other directory that is created -- not just the fonts directories.

But the bigger issue is that...

  1. You really shouldn't need chmod at all. On our systems, for example, it breaks our ACLs. And in general it doesn't solve any problems that aren't better solved in some other way. I've written a long explanation of this at chmod breaks ACLs keycdn/cache-enabler#320, so maybe you can forgive me for not reproducing it here.

Of course, if you forego the chmod entirely, the unintended FS_CHMOD_DIR side effects cease to matter.

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

1 participant