fix: base64 uploads, audit log noise, and stale chunk reloads #69

Merged
naomi merged 3 commits from fix/bugs into main 2026-02-23 20:37:52 -08:00
Owner

Summary

  • Base64 cover image uploads broken for books, shows, manga, and music — a premature validateStringLength check ran before the data URL detection, rejecting all base64 images with a 2,048-char URL limit error. Also fixed the size calculation to extract only the base64 portion after the comma (matching the correct pattern already in game.service.ts).
  • Audit log flooded with expected 401s on /api/auth/me — these occur during normal token refresh flow and are not genuine security events. Excluded this URL from the global 401/403 audit log handler.
  • ChunkLoadError spam after deployments — when Angular lazy-loaded chunks are missing (stale cache after a redeploy), the global error handler now detects ChunkLoadError and silently reloads the page instead of logging the error and sending it to the API/Discord.

Test plan

  • Upload a base64 cover image for a book, show, manga, and music item — should succeed
  • Verify /api/auth/me 401s no longer appear in the audit log
  • Deploy a new build and confirm stale-chunk users are silently reloaded

This PR was created with help from Hikari~ 🌸

## Summary - **Base64 cover image uploads broken for books, shows, manga, and music** — a premature `validateStringLength` check ran before the data URL detection, rejecting all base64 images with a 2,048-char URL limit error. Also fixed the size calculation to extract only the base64 portion after the comma (matching the correct pattern already in `game.service.ts`). - **Audit log flooded with expected 401s on `/api/auth/me`** — these occur during normal token refresh flow and are not genuine security events. Excluded this URL from the global 401/403 audit log handler. - **ChunkLoadError spam after deployments** — when Angular lazy-loaded chunks are missing (stale cache after a redeploy), the global error handler now detects `ChunkLoadError` and silently reloads the page instead of logging the error and sending it to the API/Discord. ## Test plan - [ ] Upload a base64 cover image for a book, show, manga, and music item — should succeed - [ ] Verify `/api/auth/me` 401s no longer appear in the audit log - [ ] Deploy a new build and confirm stale-chunk users are silently reloaded ✨ This PR was created with help from Hikari~ 🌸
hikari added 3 commits 2026-02-23 20:33:56 -08:00
Remove premature URL length check that ran before data URL detection,
causing all base64 uploads to be incorrectly rejected. Also fix size
calculation to use only the base64 data portion (after the comma) rather
than the full data URL string, matching the correct pattern already in
game.service.ts.
Token expiry probes against /api/auth/me are expected behaviour during
the refresh flow and should not generate unauthorized access audit events.
fix: silently reload on ChunkLoadError after deployments
Node.js CI / CI (pull_request) Successful in 1m47s
Security Scan and Upload / Security & DefectDojo Upload (pull_request) Successful in 1m53s
e8610667b5
Stale chunk errors occur when a user has an old version of the app cached
after a redeployment. Detect ChunkLoadError before logging so the page
reloads automatically without showing a toast or sending noise to the API.
naomi merged commit 6d5b0581a5 into main 2026-02-23 20:37:52 -08:00
naomi deleted branch fix/bugs 2026-02-23 20:37:55 -08:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: nhcarrigan/library#69