From 756ddb57654589960d8f2bd0ff592b08f5ecc99e Mon Sep 17 00:00:00 2001 From: Pontoporeia Date: Mon, 6 Apr 2026 16:39:55 +0200 Subject: [PATCH] fix: RateLimit graceful degradation on permission denied Silence mkdir() with @ operator; guard file_put_contents with is_writable() check. When storage/cache/rate_limit is not writable by php-fpm, requests are allowed through instead of throwing warnings that flood the nginx error log. --- TODO.md | 3 +++ scripts/deploy-server.sh | 6 ++++++ scripts/setup-server.sh | 6 ++++++ src/RateLimit.php | 8 +++++--- 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/TODO.md b/TODO.md index b6fccea..3a1b5c5 100644 --- a/TODO.md +++ b/TODO.md @@ -11,6 +11,9 @@ Pending tasks have been split into topic files under [`todo/`](todo/README.md): ## Recently completed (this session) +- [x] `RateLimit.php` — silence `mkdir()` with `@`; guard `file_put_contents` with `is_writable()` check so permission errors degrade gracefully (allow request, skip write) instead of spamming nginx error log +- [x] `scripts/deploy-server.sh` + `scripts/setup-server.sh` — add `mkdir -p storage/cache/rate_limit` + `chown`/`chmod 2775` so php-fpm has write access on fresh deploys + - [x] CSS cleanup — removed dark-mode `@media (prefers-color-scheme: dark)` block from `variables.css`; deleted dead `colors.css` reference file; added all missing semantic tokens to `variables.css` (`--header-*`, `--search-error-*`, `--sys-*` dark-terminal tokens, `--*-muted-bg/border/hover` alpha overlay tokens); replaced every hardcoded hex/rgba in `common.css`, `main.css`, `search.css`, `admin.css`, `system.css` with `var()` references; fixed `--border-color` typo → `--border-primary` in `search.css`; fixed `view-toggle__btn` active color to use `--accent-foreground`; updated `README.md`; admin and public now share identical token set with zero duplication - [x] `pages-edit.php` — replaced EasyMDE (333 KB: 320 KB JS + 13 KB CSS) with OverType (118 KB, single JS file, no CSS); removed `easymde.min.js` and `easymde.min.css` from `public/assets/`; vendored `overtype.min.js`; replaced `