From d1ce80341270216db5fd0bdaffd0f9465fd3017a Mon Sep 17 00:00:00 2001 From: code Date: Thu, 16 Jul 2026 05:30:10 +0000 Subject: [PATCH] Fix review findings; consolidate pre-release migrations Bug fixes: - Deleting a user with comments no longer 500s: remove the user's comments first (covers old DBs) and add ON DELETE CASCADE to the FK. - Drop 'svg' from the default media upload allowlist (stored-XSS vector for files served directly from public/uploads/). - Content index now reindexes on page deletion: track routable page count in content_index_meta and treat a count change as stale, since the newest-mtime check alone can't see a removal. - Dev router (public/router.php) preserves the query string across the canonical trailing-slash redirect, matching .htaccess. - Fix stale worked-example reference in the comments thread partial. Migrations: since v2 is unreleased with no live databases, fold the incremental ALTERs into the base migrations rather than shipping them separately: verification columns into 0002_create_users.sql, source_count into 0001_create_content_index.sql; renumber comments to 0003. Update all code/doc references to the removed/renamed files. Co-Authored-By: Claude Opus 4.8 --- novaconium/config.php | 9 +++++-- .../migrations/0001_create_content_index.sql | 1 + novaconium/migrations/0002_create_users.sql | 5 +++- .../0003_add_users_verification.sql | 4 --- ..._comments.sql => 0003_create_comments.sql} | 2 +- .../pages/_partials/comments/thread.twig | 2 +- .../pages/admin/docs/admin-auth/index.twig | 2 +- .../pages/admin/docs/comments/index.twig | 2 +- novaconium/pages/admin/users/index.php | 9 +++++++ novaconium/src/AdminAuth.php | 9 ++++--- novaconium/src/ContentIndexer.php | 26 ++++++++++++++++--- public/router.php | 6 ++++- 12 files changed, 57 insertions(+), 20 deletions(-) delete mode 100644 novaconium/migrations/0003_add_users_verification.sql rename novaconium/migrations/{0004_create_comments.sql => 0003_create_comments.sql} (78%) diff --git a/novaconium/config.php b/novaconium/config.php index 1890309..7f0580e 100644 --- a/novaconium/config.php +++ b/novaconium/config.php @@ -111,8 +111,13 @@ return [ // against the uploaded filename's extension; media_upload_max_bytes // caps a single file's size (checked against both $_FILES' reported // size and PHP's own upload_max_filesize/post_max_size ini limits, - // see /admin/docs/media-manager). - 'media_upload_extensions' => ['jpg', 'jpeg', 'png', 'gif', 'webp', 'svg', 'pdf', 'txt', 'zip'], + // see /admin/docs/media-manager). 'svg' is deliberately NOT in this + // default list: files under public/uploads/ are served directly from + // this origin, and an SVG can carry inline