[
https://issues.apache.org/jira/browse/WW-5873?focusedWorklogId=1056823&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1056823
]
ASF GitHub Bot logged work on WW-5873:
--------------------------------------
Author: ASF GitHub Bot
Created on: 24/Nov/26 09:58
Start Date: 24/Nov/26 09:58
Worklog Time Spent: 10m
Work Description: shadowe1ite opened a new pull request, #2160:
URL: https://github.com/apache/struts/pull/2160
Fixes [WW-5873](https://issues.apache.org/jira/browse/WW-5873)
`struts.multipart.maxSizeOfFiles` wasn't really enforced.
`JakartaMultiPartRequest` never checked it, and `JakartaStreamMultiPartRequest`
only checked it after the whole file was already on disk.
The check now lives in `AbstractMultiPartRequest` and both parsers use it.
The streaming parser stops writing as soon as the remaining budget is used up
and deletes the partial file. The old two-arg `streamFileToDisk` is still there
for subclasses.
One small behavior change: a total exactly equal to the limit is now
accepted. The streaming parser used to reject it because it compared with `>=`.
The default parser still lets commons-fileupload parse the whole request
first, so what it buffers is still bounded by `struts.multipart.maxSize`, same
as before.
Tests for both parsers (single file over the limit, a second file crossing
it, files exactly at the limit) plus one for the streaming parser checking that
a 1 MB upload with a 10 byte limit writes no more than 10 bytes. 4 of them fail
without the fix; all multipart and upload tests in core pass with it.
Issue Time Tracking
-------------------
Worklog Id: (was: 1056823)
Remaining Estimate: 0h
Time Spent: 10m
> struts.multipart.maxSizeOfFiles is not enforced by JakartaMultiPartRequest
> and is checked too late by JakartaStreamMultiPartRequest
> -----------------------------------------------------------------------------------------------------------------------------------
>
> Key: WW-5873
> URL: https://issues.apache.org/jira/browse/WW-5873
> Project: Struts 2
> Issue Type: Bug
> Components: Core
> Affects Versions: 7.5.0
> Reporter: ALAN S
> Priority: Minor
> Time Spent: 10m
> Remaining Estimate: 0h
>
> {\{JakartaMultiPartRequest}} never checks
> \{{struts.multipart.maxSizeOfFiles}}, so files larger than the configured
> total are accepted.
> {\{JakartaStreamMultiPartRequest}} only checks it after the whole file has
> been written to disk, so the limit does not bound disk writes.
> Both parsers should reject a file that would push the total over
> \{{maxSizeOfFiles}}, and the streaming parser should stop writing once the
> limit is reached.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)