Skip to content

fix: deny backups, dumps, logs and dotfiles in nginx - #43

Merged
vitormattos merged 1 commit into
fix/php-allowlistfrom
fix/deny-sensitive-files
Nov 14, 2026
Merged

vitormattos merged 1 commit into
fix/php-allowlistfrom
fix/deny-sensitive-files

Conversation

@YvesCesar

Copy link
Copy Markdown
Member

Depends on #42 (based on its branch).

nginx served any static file it found. Database dumps, wp-config.php backups, archives, debug.log, WooCommerce logs (whose .htaccess is ignored by nginx), backup plugin folders and dependency manifests could be downloaded by anyone who knew or guessed the path. Only .ht* and .git were blocked among dotfiles.

Changes

default.conf returns 403 for:

  • dotfiles, except .well-known/;
  • .sql, .bak, .old, .orig, .save, .swp, .swo, .log, .sh, .dist, .lock, .tar, .tgz, .gz, .bz2, .xz, .7z, .rar, .wpress and files ending in ~;
  • .zip outside wp-content/uploads/YYYY/MM/, so media library attachments keep working;
  • wp-content/debug.log, updraft, ai1wm-backups, aiowps_backups, backup*, upgrade, uploads/wc-logs and uploads/woocommerce_uploads;
  • composer.json, composer.lock, package.json, package-lock.json and phpunit*.xml(.dist).

The README lists these rules.

Tests

tests/security/sensitive-files.bats covers 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.

@vitormattos
vitormattos merged commit 071fd94 into fix/php-allowlist Nov 14, 2026
3 checks passed
@vitormattos
vitormattos deleted the fix/deny-sensitive-files branch November 14, 2026 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants