Skip to content

Validate sponsor graphic uploads, remove silent 300k slice, and alert on failures - #440

Merged
alexeygrigorev merged 1 commit into
mainfrom
hub/intake-4dcb3ca7b2deec89ca7f5986284f6cff2e32a0805a6f55a4af659aa70dea0c30
Nov 13, 2026
Merged

alexeygrigorev merged 1 commit into
mainfrom
hub/intake-4dcb3ca7b2deec89ca7f5986284f6cff2e32a0805a6f55a4af659aa70dea0c30

Conversation

@alexeygrigorev

Copy link
Copy Markdown
Member

Fixes intake c342af2b:

  • Remove silent 300000-char slice in sanitizeTemplateContent (backend/src/sponsorDocs/templates.ts) and reject data:image/ URIs or >2048-char URLs loudly with SponsorDocValidationError.
  • Add full structural decode (PNG IHDR/IDAT zlib inflate/IEND, JPEG SOF+EOI, GIF header+trailer, WebP RIFF+chunk) and pixel dimension bounds validation (1x1..10000x10000, max 40MP) in backend/src/publicImages.ts.
  • Alert operators on sponsor image upload failures (structured sponsor_image_upload_failed ERROR log + createNotification in backend/src/routes/sponsorDocs.ts; client-side oversized pre-check alert to /api/client-errors and visible form error in frontend/src/surfaces/operations/sponsor-doc-visual.js).
  • Add regression tests with a >300KB PNG (byte-identical round-trip + newsletter preview render) and truncated/bad-dimension PNGs in backend/tests/public-images.test.ts and backend/e2e/brief-inline-images.spec.js.

@alexeygrigorev
alexeygrigorev merged commit 03f7bd8 into main Nov 13, 2026
4 checks passed
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