Repository navigation
Conversation
Signed-off-by: YvesCesar <[email protected]>
Signed-off-by: YvesCesar <[email protected]>
This was referenced Nov 14, 2026
fix: deny backups, dumps, logs and dotfiles in nginx
vitormattos
approved these changes
Nov 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
default.confsent every*.phprequest to PHP-FPM except underwp-content/uploadsandvendorfolders. Any PHP file that ended up anywhere else in the document root (the root itself,wp-content/cache,wp-content/languages, inside a plugin or theme) was executed, and files such as.phtmlor.PHPwere served as plain text. XML-RPC was enabled unless the deployment setWORDPRESS_XMLRPC_ENABLED=0, andwp-admin/install.phpstayed open until the browser setup was completed.Changes
.docker/nginx/snippets/php-fpm.conf, mounted at/etc/nginx/snippets/.index.php,wp-login.php,wp-cron.php,wp-comments-post.php,wp-signup.php,wp-activate.php,wp-trackback.php,wp-links-opml.php, the scripts directly underwp-admin/(pluswp-admin/network/andwp-admin/user/) andwp-includes/js/tinymce/wp-tinymce.php. Any other.php,.php[0-9],.phtml,.pharor.phtpath returns 404, case-insensitively. The existing 403 rules foruploadsandvendorstay in front.WORDPRESS_XMLRPC_ENABLEDnow defaults to0. When enabled, the generated file servesxmlrpc.phpthrough the snippet.41-web-install.sh:install.phpandsetup-config.phpreturn 404 unlessWORDPRESS_WEB_INSTALL_ENABLED=1is set on nginx.wp core installon the first start whenWORDPRESS_SITE_URL,WORDPRESS_ADMIN_USER,WORDPRESS_ADMIN_PASSWORDandWORDPRESS_ADMIN_EMAILare set (WORDPRESS_SITE_TITLEis optional).location ^~inserver.d.Deployments that relied on XML-RPC, on the browser installer or on a plugin PHP file reached directly need to enable it explicitly.
Tests
tests/security/php-allowlist.batsruns the real config against PHP-FPM. It fails onmain(unknown PHP at the root, underwp-content/cache,languages, plugins and themes,.phtml/.PHP,wp-config.php,wp-admin/includes,wp-includesand the installer all reach PHP or leak the source) and passes here. The XML-RPC, server snippet and vendor tests were updated to the new defaults.bats tests/security: 31/31; ShellCheck clean; image builds.Also checked on a fresh stack started from this branch with WooCommerce: install through the new variables, front page,
wp-login.phpfor admin and customer, wp-admin pages,admin-ajax.php,admin-post.php,load-scripts.php,/wp-json/, the Store API,wp-cron.php, cart, checkout with an order placed, and My Account with the orders list all work.