Skip to content

Commit

Permalink
Improve uploads folder security - closes #3428
Browse files Browse the repository at this point in the history
  • Loading branch information
freescout-help-desk committed Sep 27, 2023
1 parent 258b774 commit 1daa34f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions storage/app/public/.htaccess
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# The list should be in sync with /config/app.php and nginx config.
<FilesMatch "\.((?!(jpg|jpeg|jfif|pjpeg|pjp|apng|bmp|gif|ico|cur|png|tif|tiff|webp|pdf|txt|diff|patch|json|mp3|wav|ogg|wma)).)*$">
ForceType application/octet-stream
Header set Content-Disposition attachment
Expand Down
5 changes: 5 additions & 0 deletions tools/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,11 @@ sudo echo 'server {
access_log off;
add_header Cache-Control "public, must-revalidate";
}
# The list should be in sync with /storage/app/public/uploads/.htaccess and /config/app.php
location ~* ^/storage/.*\.((?!(jpg|jpeg|jfif|pjpeg|pjp|apng|bmp|gif|ico|cur|png|tif|tiff|webp|pdf|txt|diff|patch|json|mp3|wav|ogg|wma)).)*$ {
add_header Content-disposition "attachment; filename=$1";
default_type application/octet-stream;
}
location ~* ^/(?:css|fonts|img|installer|js|modules|[^\\\]+\..*)$ {
expires 1M;
access_log off;
Expand Down

0 comments on commit 1daa34f

Please sign in to comment.