[
https://issues.apache.org/jira/browse/WW-5408?focusedWorklogId=913566&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-913566
]
ASF GitHub Bot logged work on WW-5408:
--------------------------------------
Author: ASF GitHub Bot
Created on: 09/Apr/24 05:34
Start Date: 09/Apr/24 05:34
Worklog Time Spent: 10m
Work Description: jefferyxhy opened a new pull request, #912:
URL: https://github.com/apache/struts/pull/912
WW-5408
**Reason**
There is a case we want to enhance to improve security for struts url
mapping: Be able to prevent arbitrary namespace fallback to empty (root)
namespace when not match
**Changes/ Solution**
* introduce new Struts constant ` STRUTS_DISABLE_EMPTY_NAMESPACE_FALLBACK
[struts.disableActionConfigFallbackToEmptyNamespace]` to disable fallback to
empty namespace when not match
* default as null which means does not disable (Need to manually set as
true in confluence struts.xml)
**Result & Impact**
* By default `struts.disableActionConfigFallbackToEmptyNamespace` is `null`,
no difference.
* Set `struts.disableActionConfigFallbackToEmptyNamespace` as `true`, not
matched namepsace **WILL NOT** fallback to empty namespace anymore, and struts
will threw `ConfigurationException`, it relies on the application to handle
this exception.
Issue Time Tracking
-------------------
Worklog Id: (was: 913566)
Remaining Estimate: 0h
Time Spent: 10m
> Add option to NOT fallback to empty namespace when unresolved
> -------------------------------------------------------------
>
> Key: WW-5408
> URL: https://issues.apache.org/jira/browse/WW-5408
> Project: Struts 2
> Issue Type: Improvement
> Components: Core
> Reporter: Kusal Kithul-Godage
> Priority: Minor
> Fix For: 6.5.0
>
> Time Spent: 10m
> Remaining Estimate: 0h
>
> Currently, when a namespace cannot be resolved from a request URL, it falls
> back to the empty namespace.
> This effectively allows all Actions which are defined for the empty namespace
> to be accessed from an infinite number of endpoints.
> For example, you may have an Action defined in the empty namespace, intended
> for access at:
> {{www.domain.com/login.action}}
> However, due to the current fallback behaviour, this Action can actually be
> accessed at any non-resolving namespace, eg.:
> {{www.domain.com/what/about/this/login.action}}
> This behaviour is not usually beneficial and could lead to bugs if a
> developer only expects their Action to be accessible at a very specific URL.
> Many developers may not be aware of these Action resolving quirks of Struts.
> As far as I can tell, there is not currently an option to prevent this
> behaviour, so I propose we add one.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)