Repository navigation
fix: deny backups, dumps, logs and dotfiles in nginx - #43
Merged
Merged
Conversation
Signed-off-by: YvesCesar <[email protected]>
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.
Depends on #42 (based on its branch).
nginx served any static file it found. Database dumps,
wp-config.phpbackups, archives,debug.log, WooCommerce logs (whose.htaccessis ignored by nginx), backup plugin folders and dependency manifests could be downloaded by anyone who knew or guessed the path. Only.ht*and.gitwere blocked among dotfiles.Changes
default.confreturns 403 for:.well-known/;.sql,.bak,.old,.orig,.save,.swp,.swo,.log,.sh,.dist,.lock,.tar,.tgz,.gz,.bz2,.xz,.7z,.rar,.wpressand files ending in~;.zipoutsidewp-content/uploads/YYYY/MM/, so media library attachments keep working;wp-content/debug.log,updraft,ai1wm-backups,aiowps_backups,backup*,upgrade,uploads/wc-logsanduploads/woocommerce_uploads;composer.json,composer.lock,package.json,package-lock.jsonandphpunit*.xml(.dist).The README lists these rules.
Tests
tests/security/sensitive-files.batscovers each group against the real config, plus a check that media, plugin assets and ACME challenges are still served. The deny cases fail on the base branch and pass here.bats tests/security: 39/39; ShellCheck clean.On a fresh stack with WooCommerce, login, wp-admin,
/wp-json/,wp-cron.php, checkout and My Account keep working.