Skip to content

Commit

Permalink
Improved: Add permission check for view-maps and change defaults for …
Browse files Browse the repository at this point in the history
…request-maps (OFBIZ-13130) (#831)

* [Improved]: Add permission check for view-maps and change defaults for
request-maps [(OFBIZ-13130)]

Adds an auth parameter to view-maps. The parameter is used in renderView
and initializes a security check.

* [Improved]: Add permission check for view-maps and change defaults for
request-maps [(OFBIZ-13130)]

Changes the defaults of the request-map parameters auth and https to
true.

* [Improved]: Add permission check for view-maps and change defaults for
request-maps [(OFBIZ-13130)]

Adds missing request- and view-map parameters in framework to restore
the original functionality.

* [Improved]: Add permission check for view-maps and change defaults for
request-maps [(OFBIZ-13130)]

Adds missing view-map parameter in applications/accounting to restore
the original functionality.

* [Improved]: Add permission check for view-maps and change defaults for
request-maps [(OFBIZ-13130)]

Adds missing request-map parameter in applications/content to restore
the original functionality.

* [Improved]: Add permission check for view-maps and change defaults for
request-maps [(OFBIZ-13130)]

Adds missing request- and view-map parameters in framework to restore
the original functionality.

* [Improved]: Add permission check for view-maps and change defaults for
request-maps [(OFBIZ-13130)]

Adds missing request- and view-map parameters in applications/product to
restore the original functionality.

* [Improved]: Add permission check for view-maps and change defaults for
request-maps [(OFBIZ-13130)]

Adds missing request-map parameter in applications/workeffort to restore
the original functionality.
  • Loading branch information
stschikin authored Aug 23, 2024
1 parent 9d43c4d commit 9fe40f8
Show file tree
Hide file tree
Showing 12 changed files with 94 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2630,7 +2630,7 @@ under the License.
<!-- end of request mappings -->

<!-- View Mappings -->
<view-map name="main" type="screen" page="component://accounting/widget/CommonScreens.xml#main"/>
<view-map name="main" type="screen" page="component://accounting/widget/CommonScreens.xml#main" auth="false"/>

<!-- BillingAccount -->
<view-map name="FindBillingAccount" type="screen" page="component://accounting/widget/BillingAccountScreens.xml#FindBillingAccount"/>
Expand Down
1 change: 1 addition & 0 deletions applications/content/webapp/content/WEB-INF/controller.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ under the License.
</request-map>

<request-map uri="chain">
<security https="false" auth="false"/>
<event type="java" path="org.apache.ofbiz.webapp.event.TestEvent" invoke="test"/>
<response name="success" type="request" value="/view"/>
<response name="error" type="view" value="error"/>
Expand Down
34 changes: 18 additions & 16 deletions applications/order/webapp/ordermgr/WEB-INF/controller.xml
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,7 @@ under the License.
</request-map>

<request-map uri="setDesiredAlternateGwpProductId">
<security https="false" auth="false"/>
<event type="java" path="org.apache.ofbiz.order.shoppingcart.ShoppingCartEvents" invoke="setDesiredAlternateGwpProductId"/>
<response name="success" type="view" value="showcart"/>
<response name="error" type="view" value="showcart"/>
Expand All @@ -673,6 +674,7 @@ under the License.
<response name="error" type="request" value="orderentry"/>
</request-map>
<request-map uri="quickadd">
<security https="false" auth="false"/>
<response name="success" type="view" value="quickadd"/>
</request-map>

Expand Down Expand Up @@ -770,19 +772,19 @@ under the License.
<!-- For checkout steps that use finalizeOrder: This request chain is for calculating shipping & tax before getting to the payments page, so that the visitor
will know the full shipping & tax charges when trying to split payments between various payment methods -->
<request-map uri="calcShippingBeforePayment">
<security direct-request="false"/>
<security https="false" auth="false" direct-request="false"/>
<event type="java" path="org.apache.ofbiz.order.shoppingcart.shipping.ShippingEvents" invoke="getShipEstimate"/>
<response name="success" type="request" value="calcTaxBeforePayment"/>
<response name="error" type="request" value="orderentry"/>
</request-map>
<request-map uri="calcTaxBeforePayment">
<security direct-request="false"/>
<security https="false" auth="false" direct-request="false"/>
<event type="java" path="org.apache.ofbiz.order.shoppingcart.CheckOutEvents" invoke="calcTax"/>
<response name="success" type="request" value="validatePaymentMethodsBeforePayment"/>
<response name="error" type="request" value="orderentry"/>
</request-map>
<request-map uri="validatePaymentMethodsBeforePayment">
<security direct-request="false"/>
<security https="false" auth="false" direct-request="false"/>
<event type="java" path="org.apache.ofbiz.order.shoppingcart.CheckOutEvents" invoke="checkPaymentMethods"/>
<response name="success" type="view" value="billsetting"/>
<response name="error" type="request" value="orderentry"/>
Expand Down Expand Up @@ -885,13 +887,13 @@ under the License.
</request-map>

<request-map uri="calcShipping">
<security direct-request="false"/>
<security https="false" auth="false" direct-request="false"/>
<event type="java" path="org.apache.ofbiz.order.shoppingcart.shipping.ShippingEvents" invoke="getShipEstimate"/>
<response name="success" type="request" value="calcTax"/>
<response name="error" type="request" value="orderentry"/>
</request-map>
<request-map uri="calcTax">
<security direct-request="false"/>
<security https="false" auth="false" direct-request="false"/>
<event type="java" path="org.apache.ofbiz.order.shoppingcart.CheckOutEvents" invoke="calcTax"/>
<response name="success" type="view" value="confirm"/>
<response name="error" type="request" value="orderentry"/>
Expand Down Expand Up @@ -1003,20 +1005,20 @@ under the License.
<response name="error" type="view" value="confirm"/>
</request-map>
<request-map uri="checkDenyList">
<security direct-request="false"/>
<security https="false" auth="false" direct-request="false"/>
<event type="java" path="org.apache.ofbiz.order.shoppingcart.CheckOutEvents" invoke="checkOrderDenylist"/>
<response name="success" type="request" value="processpayment"/>
<response name="failed" type="request" value="failedDenylist"/>
<response name="error" type="view" value="confirm"/>
</request-map>
<request-map uri="failedDenylist">
<security direct-request="false"/>
<security https="false" auth="false" direct-request="false"/>
<event type="java" path="org.apache.ofbiz.order.shoppingcart.CheckOutEvents" invoke="failedDenylistCheck"/>
<response name="success" type="view" value="main"/>
<response name="error" type="view" value="main"/>
</request-map>
<request-map uri="processpayment">
<security direct-request="false"/>
<security https="false" auth="false" direct-request="false"/>
<event type="java" path="org.apache.ofbiz.order.shoppingcart.CheckOutEvents" invoke="processPayment"/>
<response name="success" type="request" value="clearcart"/>
<response name="fail" type="view" value="confirm"/>
Expand All @@ -1029,15 +1031,15 @@ under the License.
<response name="error" type="view" value="confirm"/>
</request-map>
<request-map uri="clearpocart">
<security https="true" direct-request="false"/>
<security https="true" auth="false" direct-request="false"/>
<event type="java" path="org.apache.ofbiz.order.shoppingcart.ShoppingCartEvents" invoke="destroyCart"/>
<response name="success" type="request-redirect" value="orderview">
<redirect-parameter name="orderId"/>
</response>
<response name="error" type="view" value="confirm"/>
</request-map>
<request-map uri="emailorder">
<security https="true" direct-request="false"/>
<security https="true" auth="false" direct-request="false"/>
<event type="service" path="async" invoke="sendOrderConfirmation"/>
<response name="success" type="request-redirect" value="orderview">
<redirect-parameter name="orderId"/>
Expand Down Expand Up @@ -2020,7 +2022,7 @@ under the License.
<!-- View Mappings -->
<view-map name="LookupProductCategory" type="screen" page="component://product/widget/catalog/LookupScreens.xml#LookupProductCategory"/>

<view-map name="main" type="screen" page="component://order/widget/ordermgr/OrderViewScreens.xml#Main"/>
<view-map name="main" type="screen" page="component://order/widget/ordermgr/OrderViewScreens.xml#Main" auth="false"/>

<view-map name="orderstats" type="screen" page="component://order/widget/ordermgr/OrderViewScreens.xml#OrderStats"/>
<view-map name="findorders" type="screen" page="component://order/widget/ordermgr/OrderViewScreens.xml#OrderFindOrder"/>
Expand All @@ -2037,7 +2039,7 @@ under the License.


<view-map name="survey" type="screen" page="component://order/widget/ordermgr/OrderEntryCartScreens.xml#survey"/>
<view-map name="showcart" type="screen" page="component://order/widget/ordermgr/OrderEntryCartScreens.xml#ShowCart"/>
<view-map name="showcart" type="screen" page="component://order/widget/ordermgr/OrderEntryCartScreens.xml#ShowCart" auth="false"/>
<view-map name="checkinits" type="screen" page="component://order/widget/ordermgr/OrderEntryScreens.xml#CheckInits"/>
<view-map name="orderagreements" type="screen" page="component://order/widget/ordermgr/OrderEntryScreens.xml#OrderAgreements"/>
<view-map name="viewshoppinglists" type="screen" page="component://order/widget/ordermgr/OrderEntryScreens.xml#ViewShoppingLists"/>
Expand All @@ -2055,17 +2057,17 @@ under the License.
<view-map name="category" type="screen" page="component://order/widget/ordermgr/OrderEntryCatalogScreens.xml#category"/>
<view-map name="product" type="screen" page="component://order/widget/ordermgr/OrderEntryCatalogScreens.xml#product"/>
<view-map name="compareProducts" type="screen" page="component://order/widget/ordermgr/OrderEntryCatalogScreens.xml#compareProducts"/>
<view-map name="quickadd" type="screen" page="component://order/widget/ordermgr/OrderEntryCatalogScreens.xml#quickadd"/>
<view-map name="quickadd" type="screen" page="component://order/widget/ordermgr/OrderEntryCatalogScreens.xml#quickadd" auth="false"/>
<view-map name="AddGiftCertificate" type="screen" page="component://order/widget/ordermgr/OrderEntryCartScreens.xml#AddGiftCertificate"/>

<view-map name="custsetting" type="screen" page="component://order/widget/ordermgr/OrderEntryOrderScreens.xml#CustSettings"/>
<view-map name="shipsetting" type="screen" page="component://order/widget/ordermgr/OrderEntryOrderScreens.xml#ShipSettings"/>
<view-map name="EditShipAddress" type="screen" page="component://order/widget/ordermgr/OrderEntryOrderScreens.xml#EditShipAddress"/>
<view-map name="SetItemShipGroups" type="screen" page="component://order/widget/ordermgr/OrderEntryOrderScreens.xml#SetItemShipGroups"/>
<view-map name="optionsetting" type="screen" page="component://order/widget/ordermgr/OrderEntryOrderScreens.xml#OptionSettings"/>
<view-map name="billsetting" type="screen" page="component://order/widget/ordermgr/OrderEntryOrderScreens.xml#BillSettings"/>
<view-map name="confirm" type="screen" page="component://order/widget/ordermgr/OrderEntryOrderScreens.xml#ConfirmOrder"/>
<view-map name="ordercomplete" type="screen" page="component://order/widget/ordermgr/OrderViewScreens.xml#OrderHeaderView"/>
<view-map name="billsetting" type="screen" page="component://order/widget/ordermgr/OrderEntryOrderScreens.xml#BillSettings" auth="false"/>
<view-map name="confirm" type="screen" page="component://order/widget/ordermgr/OrderEntryOrderScreens.xml#ConfirmOrder" auth="false"/>
<view-map name="ordercomplete" type="screen" page="component://order/widget/ordermgr/OrderViewScreens.xml#OrderHeaderView" auth="false"/>
<view-map name="orderTerm" type="screen" page="component://order/widget/ordermgr/OrderEntryOrderScreens.xml#OrderTerms"/>
<view-map name="setAdditionalParty" type="screen" page="component://order/widget/ordermgr/OrderEntryOrderScreens.xml#SetAdditionalParty"/>

Expand Down
1 change: 1 addition & 0 deletions applications/product/webapp/catalog/WEB-INF/controller.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ under the License.
<response name="success" type="request" value="main"/>
</request-map>
<request-map uri="chain">
<security https="false" auth="false"/>
<event type="java" path="org.apache.ofbiz.webapp.event.TestEvent" invoke="test"/>
<response name="success" type="request" value="/view"/>
<response name="error" type="view" value="error"/>
Expand Down
3 changes: 2 additions & 1 deletion applications/product/webapp/facility/WEB-INF/controller.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1159,6 +1159,7 @@ under the License.
</request-map>
<!-- note: this is an insecure version of above for purposes of rendering via fop, which cannot access over https -->
<request-map uri="viewShipmentLabel">
<security https="false" auth="false"/>
<event type="java" path="org.apache.ofbiz.shipment.shipment.ShipmentEvents" invoke="viewShipmentPackageRouteSegLabelImage"/>
<response name="success" type="none" value=""/>
<response name="error" type="view" value="EditShipmentRouteSegments"/>
Expand Down Expand Up @@ -1435,7 +1436,7 @@ under the License.
<view-map name="EditShipmentPlan" type="screen" page="component://product/widget/facility/ShipmentScreens.xml#EditShipmentPlan"/>
<view-map name="ViewShipmentReceipts" type="screen" page="component://product/widget/facility/ShipmentScreens.xml#ViewShipmentReceipts"/>
<view-map name="EditShipmentPackages" type="screen" page="component://product/widget/facility/ShipmentScreens.xml#EditShipmentPackages"/>
<view-map name="EditShipmentRouteSegments" type="screen" page="component://product/widget/facility/ShipmentScreens.xml#EditShipmentRouteSegments"/>
<view-map name="EditShipmentRouteSegments" type="screen" page="component://product/widget/facility/ShipmentScreens.xml#EditShipmentRouteSegments" auth="false"/>
<view-map name="AddItemsFromOrder" type="screen" page="component://product/widget/facility/ShipmentScreens.xml#AddItemsFromOrder"/>
<view-map name="AddItemsFromInventory" type="screen" page="component://product/widget/facility/ShipmentScreens.xml#AddItemsFromInventory"/>
<view-map name="ReceiveInventoryAgainstPurchaseOrder" type="screen" page="component://product/widget/facility/ShipmentScreens.xml#ReceiveInventoryAgainstPurchaseOrder"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ under the License.
</request-map>

<request-map uri="chain">
<security https="false" auth="false"/>
<event type="java" path="org.apache.ofbiz.webapp.event.TestEvent" invoke="test"/>
<response name="success" type="request" value="/view"/>
<response name="error" type="view" value="error"/>
Expand Down
34 changes: 18 additions & 16 deletions framework/common/webcommon/WEB-INF/common-controller.xml
Original file line number Diff line number Diff line change
Expand Up @@ -182,14 +182,17 @@ under the License.
</request-map>

<request-map uri="main">
<security https="false" auth="false"/>
<response name="success" type="view" value="main"/>
</request-map>

<request-map uri="viewBlocked">
<security https="false" auth="false"/>
<response name="success" type="view" value="viewBlocked"/>
</request-map>

<request-map uri="LookupTimeDuration">
<security https="false" auth="false"/>
<response name="success" type="view" value="LookupTimeDuration"/>
</request-map>

Expand All @@ -206,7 +209,7 @@ under the License.
<!-- Common json response events, chain these after events to send json responses -->
<!-- Standard json response, For security reason (OFBIZ-5409) tries to keep only the initially called service attributes -->
<request-map uri="json">
<security direct-request="false"/>
<security https="false" auth="false" direct-request="false"/>
<event type="java" path="org.apache.ofbiz.common.CommonEvents" invoke="jsonResponseFromRequestAttributes"/>
<response name="success" type="none"/>
</request-map>
Expand Down Expand Up @@ -245,7 +248,7 @@ under the License.
<response name="error" type="request" value="js"/>
</request-map>
<request-map uri="js">
<security direct-request="false"/>
<security https="false" auth="false" direct-request="false"/>
<event type="java" path="org.apache.ofbiz.common.CommonEvents" invoke="jsResponseFromRequest"/>
<response name="success" type="none"/>
</request-map>
Expand Down Expand Up @@ -339,33 +342,32 @@ under the License.
<!--========================== AJAX events =====================-->

<!-- View Mappings -->
<view-map name="error" type="ftl" page="component://common/webcommon/error/Error.ftl"/>
<view-map name="main" type="none"/>
<view-map name="login" type="screen" page="component://common/widget/CommonScreens.xml#login"/>
<view-map name="error" type="ftl" page="component://common/webcommon/error/Error.ftl" auth="false"/>
<view-map name="main" type="none" auth="false"/>
<view-map name="login" type="screen" page="component://common/widget/CommonScreens.xml#login" auth="false"/>
<view-map name="impersonated" type="screen" page="component://common/widget/CommonScreens.xml#impersonated"/>
<view-map name="ajaxLogin" type="screen" page="component://common/widget/CommonScreens.xml#ajaxNotLoggedIn"/>
<view-map name="ajaxLogin" type="screen" page="component://common/widget/CommonScreens.xml#ajaxNotLoggedIn" auth="false"/>
<view-map name="requirePasswordChange" type="screen" page="component://common/widget/CommonScreens.xml#requirePasswordChange"/>
<view-map name="forgotPassword" type="screen" page="component://common/widget/CommonScreens.xml#forgotPassword"/>
<view-map name="EventMessages" type="screen" page="component://common/widget/CommonScreens.xml#EventMessages"/>
<view-map name="forgotPassword" type="screen" page="component://common/widget/CommonScreens.xml#forgotPassword" auth="false"/>
<view-map name="EventMessages" type="screen" page="component://common/widget/CommonScreens.xml#EventMessages" auth="false"/>

<view-map name="ListLocales" type="screen" page="component://common/widget/LookupScreens.xml#ListLocales"/>
<view-map name="ListSetCompanies" type="screen" page="component://common/widget/LookupScreens.xml#ListSetCompanies"/>
<view-map name="LookupTimeDuration" type="screen" page="component://common/widget/LookupScreens.xml#TimeDuration"/>
<view-map name="ListLocales" type="screen" page="component://common/widget/LookupScreens.xml#ListLocales" auth="false"/>
<view-map name="ListSetCompanies" type="screen" page="component://common/widget/LookupScreens.xml#ListSetCompanies" auth="false"/>
<view-map name="LookupTimeDuration" type="screen" page="component://common/widget/LookupScreens.xml#TimeDuration" auth="false"/>
<view-map name="ListTimezones" type="screen" page="component://common/widget/LookupScreens.xml#ListTimezones"/>
<view-map name="ListVisualThemes" type="screen" page="component://common/widget/LookupScreens.xml#ListVisualThemes"/>

<view-map name="ajaxAutocompleteOptions" type="screen" page="component://common/widget/CommonScreens.xml#ajaxAutocompleteOptions"/>

<view-map name="help" type="screen" page="component://common/widget/CommonScreens.xml#help"/>
<view-map name="showHelp" type="screen" page="component://common/widget/HelpScreens.xml#ShowHelp"/>
<view-map name="ShowDocument" type="screen" page="component://common/widget/HelpScreens.xml#showDocument"/>
<view-map name="showHelp" type="screen" page="component://common/widget/HelpScreens.xml#ShowHelp" auth="false"/>
<view-map name="ShowDocument" type="screen" page="component://common/widget/HelpScreens.xml#showDocument" auth="false"/>

<view-map name="viewBlocked" type="screen" page="component://common/widget/CommonScreens.xml#viewBlocked"/>
<view-map name="viewBlocked" type="screen" page="component://common/widget/CommonScreens.xml#viewBlocked" auth="false"/>

<view-map name="LookupGeo" type="screen" page="component://common/widget/LookupScreens.xml#LookupGeo"/>
<view-map name="LookupGeoName" type="screen" page="component://common/widget/LookupScreens.xml#LookupGeoName"/>
<view-map name="LookupLocale" type="screen" page="component://common/widget/LookupScreens.xml#LookupLocale"/>
<view-map name="forgotPassword" type="screen" page="component://common/widget/CommonScreens.xml#forgotPassword"/>
<view-map name="GetUiLabels" type="screentext" page="component://common/widget/CommonScreens.xml#GetUiLabels" content-type="application/json"/>
<view-map name="GetUiLabels" type="screentext" page="component://common/widget/CommonScreens.xml#GetUiLabels" auth="false" content-type="application/json"/>

</site-conf>
Loading

0 comments on commit 9fe40f8

Please sign in to comment.