Server-side cap on attachment filenames #248

Closed
opened 2026-09-17 15:31:33 +00:00 by fen · 1 comment
Collaborator

Pre-release pentest (v0.4.0 prep) low finding.

A 250-char multipart filename is accepted and stored verbatim, echoed in full in Content-Disposition. Render-side chip truncation contains it in the UI, so impact is storage/DB-field bloat only.

Proposed: reject or truncate filenames over ~128/255 chars server-side in internal/api (attachmentExtName parsing path, internal/api/server.go).

Repro: curl -F "file=@/tmp/$(python3 -c "print(chr(98)*250)+.txt")" POST /api/pastes -> 201.

Pre-release pentest (v0.4.0 prep) low finding. A 250-char multipart filename is accepted and stored verbatim, echoed in full in Content-Disposition. Render-side chip truncation contains it in the UI, so impact is storage/DB-field bloat only. Proposed: reject or truncate filenames over ~128/255 chars server-side in internal/api (attachmentExtName parsing path, internal/api/server.go). Repro: curl -F "file=@/tmp/$(python3 -c "print(chr(98)*250)+.txt")" POST /api/pastes -> 201.
poslop added the Assigned label 2026-09-17 19:12:08 +00:00
fen added In Progress and removed Assigned labels 2026-09-17 19:12:43 +00:00
fen added spent time 1 minute 2026-09-17 19:12:43 +00:00
fen added QA and removed In Progress labels 2026-09-17 19:15:13 +00:00
fen added spent time 12 minutes 2026-09-17 19:15:13 +00:00
Author
Collaborator

QA PASS (fix attempt 1, PR #253). Merged to dev, CI docker green, deployed to palette-dev and verified live: multipart create with a 250-char filename returns 201 with a 128-byte stored filename; GET /f/... Content-Disposition echoes only the 128-byte name. Note: truncation is byte-based, so a >128-byte name can lose its extension (e.g. 246 b's + .txt -> 128 b's). Acceptable for this finding.

QA PASS (fix attempt 1, PR #253). Merged to dev, CI docker green, deployed to palette-dev and verified live: multipart create with a 250-char filename returns 201 with a 128-byte stored filename; GET /f/... Content-Disposition echoes only the 128-byte name. Note: truncation is byte-based, so a >128-byte name can lose its extension (e.g. 246 b's + .txt -> 128 b's). Acceptable for this finding.
fen added spent time 9 minutes 2026-09-17 19:19:46 +00:00
fen removed the QA label 2026-09-17 19:19:46 +00:00
fen closed this issue 2026-09-17 19:19:46 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Total Time Spent: 22 minutes
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: poslop/palette#248