Make native filesystem directory permissions configurable to support shared POSIX ACL access
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 74/100
Línea de trabajo
Comienza en src/Filesystem/AbstractAdapter.php::makeDirectory(), donde el modo 0755 está codificado de forma fija, y en src/Providers/ViewServiceProvider.php::boot(), que desencadena la creación de los directorios storage/statamic/tmp/nocache durante el arranque. Añade un ajuste directory_permissions con valor predeterminado 0755 en config/statamic/system.php y léelo donde makeDirectory pasa el modo, sin tocar la configuración del escritor de páginas estáticas ni aplicar chmod a directorios existentes. Se considera terminado cuando un 0775/0770 configurado se usa para los directorios recién creados (cubierto por una prueba en el adaptador nativo) mientras el comportamiento predeterminado permanece sin cambios.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Bug description
Statamic’s native filesystem adapter creates directories with a hardcoded 0755 mode. On Linux deployments where CLI and web processes use different Unix accounts and share write access through POSIX ACLs, this restricts the inherited access ACL mask to r-x.
The named user entries are inherited, but their effective write permission is removed. This can prevent Blade nocache fragments from being written:
file_put_contents(.../storage/statamic/tmp/nocache/_nocache….blade.php):
Failed to open stream: Permission denied
The permission mechanism was reproduced locally using Statamic’s native filesystem adapter.
Relevant code
ViewServiceProvider::boot()(https://github.com/statamic/cms/blob/v6.34.1/src/Providers/ViewServiceProvider.php) createsstorage/statamic/tmp/nocacheduring application boot, including CLI boot.AbstractAdapter::makeDirectory()(https://github.com/statamic/cms/blob/v6.34.1/src/Filesystem/AbstractAdapter.php) delegates to Laravel’s filesystem with mode0755, recursive creation enabled.CompilesNocache::compileNocache()(https://github.com/statamic/cms/blob/v6.34.1/src/View/Blade/Concerns/CompilesNocache.php) writes fragments throughStatamic\Facades\File.
This path uses the native filesystem adapter, so Laravel disk permissions configured in config/filesystems.php do not affect it. The static page writer’s configurable permissions also do not cover these temporary Blade views.
Reproduction
Proposed change
Expose the native filesystem directory creation mode through configuration, preserving 0755 as the default for backwards compatibility.
For example, introduce a setting in config/statamic/system.php:
'directory_permissions' => 0755,
The native adapter would use that configured mode instead of the hardcoded value. Deployments using shared group or ACL access could choose 0775 or 0770.
This should affect newly created directories only, without recursively changing existing permissions or altering the separate static page writer configuration.
Expected behavior
With a configured mode of 0775 or 0770, inherited ACL write permissions remain effective for the other account, allowing CLI and web processes to share Statamic’s temporary directories.
Changing the process umask alone cannot solve this: it cannot add the group-class write bit missing from the explicitly requested 0755 mode.
How to reproduce
In a disposable application checkout:
- Use different Unix accounts for CLI commands and web requests.
- Grant both accounts write access to
storage/statamicthrough access and default ACLs, with a default mask ofrwx. - Start with
storage/statamic/tmp/nocacheabsent. - Boot the application through a CLI command.
- Render a Blade template containing a nocache region through the web account.
Directories created by the CLI account inherit ACLs like:
user::rwx
user:web_account:rwx #effective:r-x
group::rwx #effective:r-x
mask::r-x
default:user:web_account:rwx
default:mask::rwx
The web account cannot create the fragment. The directory owner retains write access; the failure affects the other account accessing it through the masked ACL entries.
Restoring the access mask allows writing again:
setfacl -R -m m::rwX storage/statamic/tmp
Logs
Environment
- Statamic: 6.34.1
- Laravel: 12.69.3
Installation
Fresh statamic/statamic site via CLI
Additional details
No response
- Lenguaje dominante
- PHP
- Estrellas
- 4.9k
- Forks
- 647
- Merge medio
- 1 d 8 h
- PR fusionados (30 d)
- 100
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de statamic/cms
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
assets
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
Los mantenedores suelen responder en 1 día
-
accessibility
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
Los mantenedores suelen responder en 1 día
-
antlers
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
Los mantenedores suelen responder en 1 día
-
Dificultad 3/5 1-2 días Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
Todos los issues de statamic/cms
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 2 días
-
b:1.9 t:enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
Los mantenedores suelen responder en 3 días
-
backend bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
-
bug
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100