Skip to content

🐛 fix: the default logger writes no file; compiled views are not readable - #126

Merged
gfazioli merged 1 commit into
masterfrom
fix/generated-files-exposure
Oct 6, 2026
Merged

gfazioli merged 1 commit into
masterfrom
fix/generated-files-exposure

Conversation

@gfazioli

@gfazioli gfazioli commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator

For 2.1.3. This is the part of audit S6/S7 that 2.x can fix without moving anything. 3.0 moves both folders out of the plugin (on v3).

What was wrong, measured on wpbones.test

  • The default logger wrote a file the web could read. "errorlog" is the default, and the boilerplates' config/plugin.php says it saves to WordPress's log only. Yet the provider also appended every logger() call to <plugin>/storage/logs/<date>.log, and made that folder 0777. Valet's nginx served it with a 200. storage/logs exists in all 14 boilerplates, in Scotty and in Bannerize, and the Cron boilerplate still has a 2024 log in it.
  • A compiled Blade view came back as PHP source. Blade compiled into <plugin>/.cache as .bladec, also 0777, and a direct request returned the template's compiled PHP.

The fix

  • errorlog is error_log() only. It writes no file and makes no folder. single and daily keep writing where they did.
  • Compiled views are .php. A direct request now runs one out of context instead of reading it. The .bladec files earlier versions left are removed, once per request.
  • Both folders are closed off. .cache and the default storage/logs are made with wp_mkdir_p() and get an index.php and a deny-all .htaccess (Support\Storage::prepare()). A folder the plugin configured itself (plugin.logging.path) is only created, never altered.

Tests

  • composer test: 205 tests and 533 assertions, against 200 and 521 on master. The 5 new ones are in GeneratedFilesTest, and all 5 fail on master.
  • Live, in WPKirk-Developing, with storage-live-smoke.sh:
    • What it checks: a default logger() call, a Blade view, and a direct request for the compiled file.
    • v2.1.2: 3 ✗ of 6. The log file is written, a .bladec exists, and the request returns <?php.
    • This branch: 6 ✓.

Review

  • Copilot: the account's quota is exhausted.
  • Codex (gpt-6-sol, high), on the whole branch: no actionable regression.

…able

Audit S6/S7, the part 2.x can fix without moving anything:
- "errorlog", the default, is error_log() only, as its documentation says:
  up to 2.1.2 it also appended to <plugin>/storage/logs/<date>.log, which the
  web server serves as text, and made the folder for it;
- Blade compiles to .php, so a direct request runs a compiled view out of
  context instead of reading its PHP; the .bladec files left behind are
  removed once per request;
- .cache and the default storage/logs are made with wp_mkdir_p() (they were
  0777) and get an index.php and a deny-all .htaccess (Support\Storage).
@gfazioli
gfazioli merged commit 155d63c into master Oct 6, 2026
4 checks passed
@gfazioli
gfazioli deleted the fix/generated-files-exposure branch October 6, 2026 13:36
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.

1 participant