Skip to content

Commit f89d70c

Browse files
szaimenclaude
andcommitted
docs: block access to metadata files in nginx sample configs
The nginx sample configs served top-level metadata files (composer.json, composer.lock, package.json, package-lock.json, core/shipped.json) as plain files, since they matched neither a 404 block nor the static-asset extension list and fell through to `try_files $uri`. This leaked dependency information. Add a 404 location block matching these files to both the root and subdir sample configs, alongside the existing rules that hide non-public paths. Fixes #15101 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Simon L. <szaimen@e.mail.de>
1 parent 0b59b99 commit f89d70c

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

admin_manual/installation/nginx-root.conf.sample

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Nextcloud nginx configuration — root installation
2-
# Version 2026-03-26
2+
# Version 2026-06-09
33

44
# PHP-FPM backend.
55
upstream php-handler {
@@ -152,6 +152,10 @@ server {
152152
location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)(?:$|/) { return 404; }
153153
location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) { return 404; }
154154

155+
# Hide metadata files which would otherwise be served as plain files and
156+
# leak dependency information (composer.json, package.json, core/shipped.json).
157+
location ~ ^/(?:composer\.(?:json|lock)|package(?:-lock)?\.json|core/shipped\.json)$ { return 404; }
158+
155159
# Pass PHP requests to PHP-FPM.
156160
#
157161
# Important: this block must appear above the static asset locations

admin_manual/installation/nginx-subdir.conf.sample

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Nextcloud nginx configuration — subdirectory installation (/nextcloud)
2-
# Version 2026-03-26
2+
# Version 2026-06-09
33

44
# PHP-FPM backend.
55
upstream php-handler {
@@ -152,6 +152,10 @@ server {
152152
location ~ ^/nextcloud/(?:build|tests|config|lib|3rdparty|templates|data)(?:$|/) { return 404; }
153153
location ~ ^/nextcloud/(?:\.|autotest|occ|issue|indie|db_|console) { return 404; }
154154

155+
# Hide metadata files which would otherwise be served as plain files and
156+
# leak dependency information (composer.json, package.json, core/shipped.json).
157+
location ~ ^/nextcloud/(?:composer\.(?:json|lock)|package(?:-lock)?\.json|core/shipped\.json)$ { return 404; }
158+
155159
# Pass PHP requests to PHP-FPM.
156160
#
157161
# Important: this block must appear above the static asset locations

0 commit comments

Comments
 (0)