Make native filesystem directory permissions configurable to support shared POSIX ACL access
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 74/100
Hướng nghiên cứu
Bắt đầu tại src/Filesystem/AbstractAdapter.php::makeDirectory(), nơi chế độ 0755 được hardcode, và tại src/Providers/ViewServiceProvider.php::boot(), nơi kích hoạt việc tạo thư mục storage/statamic/tmp/nocache trong lúc khởi động. Thêm cài đặt directory_permissions với giá trị mặc định 0755 trong config/statamic/system.php và đọc nó tại chỗ mà makeDirectory truyền chế độ, không đụng tới cấu hình của static page writer cũng không chmod các thư mục đã tồn tại. Coi như hoàn thành khi một cấu hình 0775/0770 được dùng cho các thư mục được tạo mới (được bao phủ bởi một test trên adapter gốc) trong khi hành vi mặc định vẫn không thay đổi.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- PHP
- Star
- 4.9k
- Fork
- 647
- Merge trung bình
- 1 ngày 20 giờ
- Pull request đã merge (30 ngày)
- 113
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của statamic/cms
-
preferences
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
accessibility
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[7.x] Reintroduce parser error for mixed pipe/shorthand modifier syntaxCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởantlers
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
Maintainer thường phản hồi trong vòng 1 ngày
-
navigations
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
CP Cache Utility: Opening the cache manager times out when the Glide Cached Presets are too bigĐang mởutilities
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
statamic/cms#15623 · 2 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
Issue tương tự
-
sync-en
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày
-
sync-en
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
Maintainer thường phản hồi trong vòng 4 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
scanaislop/aislop#482 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug UI
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
Maintainer thường phản hồi trong vòng 1 ngày