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

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

                Author: ASF GitHub Bot
            Created on: 12/Nov/26 03:40
            Start Date: 12/Nov/26 03:40
    Worklog Time Spent: 10m 
      Work Description: mcc0nnell commented on PR #2115:
URL: https://github.com/apache/struts/pull/2115#issuecomment-6813686080

   I took a closer look at this change. The approach makes sense, but I noticed 
a few things worth considering before merging.
   
   The main concern is how rejected wildcard values are handled. Right now, an 
invalid segment gets replaced with an empty string, but the match still 
succeeds. For example, `actions.{1}Action` with `util.Harmless` becomes 
`actions.Action`. If that class exists, we could end up loading a different 
action instead of rejecting the match entirely. I think failing the match would 
be safer and more consistent with the existing method-name checks.
   
   A couple of smaller things:
   
   - The new character restriction also excludes valid non-ASCII Java 
identifiers and potentially supported bean names. It might be worth checking 
whether that's intentional.
   - The tests cover action class names, but not the result and 
exception-mapping class names that use the same new restriction.
   - A regression test for `$` and backslash handling would help protect the 
`Matcher.quoteReplacement` change.
   
   Overall, I think this is useful hardening. I'd mainly like to see the 
rejected-wildcard behavior addressed so we don't accidentally resolve to 
another valid class.
   




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

    Worklog Id:     (was: 1054181)
    Time Spent: 50m  (was: 40m)

> Reject unconfined wildcard substitution into class= attributes
> --------------------------------------------------------------
>
>                 Key: WW-5839
>                 URL: https://issues.apache.org/jira/browse/WW-5839
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Core
>    Affects Versions: 6.12.0, 7.0.0, 7.3.0, 7.4.0
>            Reporter: Gouri Sankar A
>            Priority: Minor
>             Fix For: 7.6.0
>
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> AbstractMatcher/ActionConfigMatcher: a wildcard "\{n}" substituted into an 
> action/result/exception-mapping class= attribute was unconfined -- any 
> matched path segment, including one containing "." or "/", landed verbatim in 
> the resulting class name. The sibling method-name slot is already gated 
> (ActionConfig#isAllowedMethod); there was no equivalent gate for the 
> class-name slot.
> Fix rejects a substituted value outside [A-Za-z0-9_$]* when filling a 
> class-name slot, instead of using it verbatim.
> Reachable only if a developer writes a wildcard mapping that substitutes into 
> class= -- application-responsibility, not a default-config issue.
> Tests: WildcardClassNameHardeningTest (new, 2 tests). Full core suite: 3742/0 
> failures.
> Affected versions: present, same code pattern, by source inspection, in the 
> 6.12.0, 7.0.0, 7.3.0 and 7.4.0 tags.
> Pull request: https://github.com/apache/struts/pull/2115 (already open, 
> narrowed)



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

Reply via email to