Skip to content

fix(upload): return 413 for uploads over -max-file-size in sandbox mode - #232

Merged
Mzack9999 merged 1 commit into
projectdiscovery:devfrom
hakarrr:fix-upload-too-large-status
Dec 2, 2026
Merged

Mzack9999 merged 1 commit into
projectdiscovery:devfrom
hakarrr:fix-upload-too-large-status

Conversation

@hakarrr

@hakarrr hakarrr commented Dec 1, 2026

Copy link
Copy Markdown

With -upload -sandbox, when r.ContentLength > maxFileSize the handler logged "request too large" and returned without writing a status, so net/http sent 200 OK and the client believed the upload worked. When the length is not declared (chunked), MaxBytesReader makes io.ReadAll fail and the handler answered 500.

This writes 413 on the declared-length path and maps *http.MaxBytesError from the body read to 413. Adds two tests (declared length, chunked).

Co-authored-by: GeneralTony007 <144252170+GeneralTony007@users.noreply.github.com>
@Mzack9999
Mzack9999 merged commit c42236d into projectdiscovery:dev Dec 2, 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.

2 participants