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

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

                Author: ASF GitHub Bot
            Created on: 17/Sep/26 05:01
            Start Date: 17/Sep/26 05:01
    Worklog Time Spent: 10m 
      Work Description: lukaszlenart opened a new pull request, #1961:
URL: https://github.com/apache/struts/pull/1961

   Follow-up to #1890, addressing the two non-blocking review notes on it.
   
   Fixes [WW-5713](https://issues.apache.org/jira/browse/WW-5713)
   
   ## What changed
   
   **Flag lookup keyed to the container's own web application.** The lazy 
`OGNL:` evaluator read `struts.tiles.ognl.legacy.enabled` from the 
`ServletContext` of whichever Tiles `Request` reached it first — walking the 
request wrappers and catching `NotAServletEnvironmentException`. A Tiles 
container is built for exactly one `ApplicationContext`, so the factory now 
captures that context's `ServletContext` at construction 
(`ServletUtil.getServletContext`) and resolves 
`Dispatcher.getInstance(servletContext)` against it. 
`isLegacyOgnlEnabled(ServletContext)` replaces `isLegacyOgnlEnabled(Request)`; 
request objects no longer participate in the decision. A non-servlet 
`ApplicationContext` cannot carry a Dispatcher and gets the disabled evaluator 
outright, with no lookup.
   
   **Removal version dropped from Javadoc, messages and README.** 
`@Deprecated(since = "7.4.0", forRemoval = true)` and WW-5714 already track the 
removal; the text no longer promises a release number.
   
   ## Tests
   
   - `nonServletApplicationContextFailsClosedWithoutLookup` — mock 
`ApplicationContext` → disabled, zero configuration resolutions, zero 
raw-evaluator constructions.
   - `flagIsReadFromTheOwningWebApplicationNotFromTheRequest` — factory built 
for a web application with the flag `false`, evaluated with a request from a 
neighbouring `ServletContext` whose flag is `true` → still disabled.
   - Existing lazy/concurrency/once-per-lifecycle tests re-pointed at a 
`ServletApplicationContext`; 
`noArgInitializerPreservesLazyWebApplicationConfiguration` now configures the 
flag on the factory's own context, since the request no longer carries it.
   
   Tiles module: 565 run, 0 failures. Security review of the diff: clean — the 
captured context is always the registering application's own 
(`StrutsTilesListener` → `StrutsTilesInitializer` → 
`BasicTilesContainerFactory.createContainer`), and the raw evaluator plus the 
`OgnlRuntime.setPropertyAccessor` mutation remain reachable only through an 
explicit `true`.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)




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

    Worklog Id:     (was: 1042185)
    Time Spent: 1h 10m  (was: 1h)

> Fail closed for legacy Tiles OGNL evaluation
> --------------------------------------------
>
>                 Key: WW-5713
>                 URL: https://issues.apache.org/jira/browse/WW-5713
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Plugin - Tiles
>            Reporter: Karan Kurani
>            Priority: Major
>             Fix For: 7.4.0
>
>          Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> The Struts Tiles plugin registers separate {{S2:}} and legacy {{OGNL:}} 
> attribute-expression evaluators.
> The {{S2:}} evaluator processes ValueStack expressions through the Struts 
> OGNL facilities. The legacy {{OGNL:}} evaluator evaluates against the Tiles 
> {{Request}} and does not use the Struts OGNL security controls used by 
> {{{}S2:{}}}.
> This hardening change keeps {{OGNL:}} registered but makes it fail closed by 
> default. Evaluation throws Tiles {{EvaluationException}} with migration 
> guidance directing users to {{{}S2:{}}}.
> Applications that temporarily require the existing raw behavior may 
> explicitly set:
> {{struts.tiles.ognl.legacy.enabled=true}}
> The compatibility flag defaults to {{false}} and is targeted for removal in 
> Struts 8.0.0.
> The raw evaluator and its global {{OgnlRuntime}} {{Request}} 
> property-accessor setup are constructed only when legacy mode is explicitly 
> enabled. This avoids mutating the shared OGNL runtime for applications using 
> the secure default.
> When legacy mode is enabled, the existing raw behavior is preserved and a 
> clear startup migration warning is emitted.
> {{{}S2:{}}}, {{{}I18N:{}}}, and {{EL:}} remain unchanged.
> Tests cover:
>  * default fail-closed behavior;
>  * exact migration guidance;
>  * non-evaluation of expression markers;
>  * construction gating;
>  * absence of global accessor initialization under the default;
>  * explicit legacy compatibility behavior;
>  * startup warning behavior; and
>  * real servlet-backed {{S2:}} evaluation.
> This is defense-in-depth hardening. No attacker-controlled expression source 
> or concrete vulnerability impact has been demonstrated, and no security 
> advisory is proposed.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to