Skip to content

Fix security audit findings: auth-check bypass, path and error-detail disclosure, fatal on bad settings - #277

Merged
shadoath merged 1 commit into
masterfrom
fix/security-audit
Oct 31, 2026
Merged

shadoath merged 1 commit into
masterfrom
fix/security-audit

Conversation

@shadoath

Copy link
Copy Markdown
Collaborator

Summary

  • Done when: with Error Display set to "Show to Logged In Users", a visitor who sets a bogus wordpress_logged_in_* cookie no longer sees the compile-error overlay, and setting the SCSS Location to /../../x is refused with a settings error.
  • Closes the findings of a security audit: the logged-in check only tested that a forgeable cookie existed; the default error mode and the error_log.log file in the SCSS directory exposed server paths and SCSS error context to anonymous visitors; an unknown sourcemap or output-style value fataled every page load; path settings accepted ..; admin notices echoed unescaped paths; cache-to-CSS copies were not atomic.
  • Behaviour changes a user can notice: "Print to Log" now writes to the PHP error log instead of error_log.log, and the error default (when the option was never saved) is "Show to Logged In Users". Readme and CLAUDE.md updated.
  • How this could fail: rename() replaces the CSS file's inode, so on hosts where a separate deploy user used to overwrite a PHP-writable CSS file in place, that user now needs write permission on the CSS directory to replace it; they notice on the next deploy, loudly.

🤖 Generated with Claude Code

… disclosure, fatal on bad settings

- "Show to Logged In Users" now uses is_user_logged_in() instead of checking that a forgeable wordpress_logged_in cookie merely exists.
- Default error mode is show-logged-in instead of show, so compile errors (which include server paths) no longer render for anonymous visitors on installs that never saved the setting.
- Errors in "Print to Log" mode go to the PHP error log via error_log() instead of a web-readable error_log.log inside the SCSS directory; the 1MB rotation code goes with it.
- Unknown sourcemap or output-style values no longer fatal every page load: the sourcemap constant is checked with defined() and the output style falls back to compressed.
- SCSS, CSS and cache paths reject ".." so they stay inside the chosen Base Location.
- Compiled CSS moves from cache to the CSS directory with rename() (atomic) with a copy fallback across filesystems.
- Directory paths in admin notices are escaped; the error overlay's allowed-tag list had "string" where it meant "strong".

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@shadoath

Copy link
Copy Markdown
Collaborator Author

@codex review

@shadoath
shadoath merged commit efccbe4 into master Oct 31, 2026
@shadoath
shadoath deleted the fix/security-audit branch October 31, 2026 13:54
@shadoath shadoath mentioned this pull request Oct 31, 2026
shadoath added a commit that referenced this pull request Oct 31, 2026
Ships scssphp 1.13.0 (#275), the PHP 8.4 nullable fixes (#276) and the security audit fixes (#277). Updates the Stable tag, Tested up to (WordPress 7.1, PHP 8.4), the bundled ScssPHP version in the readme, and adds the 5.0.0 changelog entry to readme.txt and readme.md.

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
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