[ 
https://issues.apache.org/jira/browse/WW-5878?focusedWorklogId=1057336&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1057336
 ]

ASF GitHub Bot logged work on WW-5878:
--------------------------------------

                Author: ASF GitHub Bot
            Created on: 27/Nov/26 04:42
            Start Date: 27/Nov/26 04:42
    Worklog Time Spent: 10m 
      Work Description: g0w6y opened a new pull request, #2177:
URL: https://github.com/apache/struts/pull/2177

   Fixes [WW-5878](https://issues.apache.org/jira/browse/WW-5878)
   
   File upload rejection messages logged the request-supplied field name, 
original filename and content type unchanged, so a decoded line break produced 
a forged log line. Applies `normalizeSpace`, as WW-5752 did for the other 
request-derived log messages, to:
   
   - `AbstractFileUploadInterceptor.acceptFile()`: field name, original 
filename and content type in all five rejection messages
   - `ActionFileUploadInterceptor`: field name, when no file was uploaded for it
   - `AbstractMultiPartRequest.createTemporaryFile()`: the original filename
   
   `UploadedFile.getName()` (the generated temp file name) is unaffected; it is 
never request-derived.
   
   Each change has a regression test that fails without it.
   




Issue Time Tracking
-------------------

            Worklog Id:     (was: 1057336)
    Remaining Estimate: 0h
            Time Spent: 10m

> File upload rejection logs forge lines from unnormalized request-derived 
> values
> -------------------------------------------------------------------------------
>
>                 Key: WW-5878
>                 URL: https://issues.apache.org/jira/browse/WW-5878
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Interceptors
>    Affects Versions: 6.12.0, 6.13.0, 7.0.0, 7.1.1, 7.2.1, 7.3.0, 7.4.0, 
> 7.5.0, 7.5.1
>            Reporter: Gouri Sankar A
>            Priority: Major
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> AbstractFileUploadInterceptor.acceptFile() logs its rejection messages 
> (missing file, unresolved policy, oversized file, disallowed content type, 
> disallowed extension) with the request-supplied field name, original filename 
> and content type interpolated unchanged. ActionFileUploadInterceptor's own 
> "no file uploaded for this field" message and 
> AbstractMultiPartRequest.createTemporaryFile()'s debug log do the same with 
> the field name and original filename respectively. A decoded line break in 
> any of these values produces a forged line in the application log.
> The rest of the upload code already normalizes equivalent values: 
> JakartaMultiPartRequest and JakartaStreamMultiPartRequest wrap every 
> attacker-controlled name in StringUtils.normalizeSpace(...) before logging 
> it, and AbstractMultiPartRequest itself does the same at its other log call 
> sites. These are the only remaining unnormalized sites in the upload path.
> Proposal: apply StringUtils.normalizeSpace(...) at the same seven call sites, 
> matching WW-5752's fix for the other request-derived log messages. 
> UploadedFile.getName() (the generated temp file name) is left as is; it is 
> never request-derived.
> Tests: regression tests for a line break in the field name, original filename 
> and content type, each proven to fail without the fix (LogCapture, the same 
> test helper WW-5752 added).
> Full core suite: 3813 run, 0 failures, 0 errors, 2 skipped. RAT: no issues.
> Affected Version/s: 6.12.0, 6.13.0, 7.0.0, 7.1.1, 7.2.1, 7.3.0, 7.4.0, 7.5.0, 
> 7.5.1 for the acceptFile()/ActionFileUploadInterceptor sites (confirmed 
> present unchanged on STRUTS_6_12_0, STRUTS_6_13_0, STRUTS_7_4_0 and 
> STRUTS_7_5_1). The AbstractMultiPartRequest.createTemporaryFile() site is 7.x 
> only, first present in 7.1.1 (not present on 7.0.0/7.0.3, where the shared 
> method did not yet exist); still present, unnormalized, on 7.5.1 and main. 
> This one log line was missed when WW-5501 normalized every neighbouring log 
> call on the branch that became Struts 7 in December 2024, and was simply 
> carried forward unnormalized when 824e7121b (July 2025) centralized it into 
> AbstractMultiPartRequest.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to