Extend standard find services (prepareFind, executeFind and performFind) to use a built dynamicView instead of just an entityName.
With this, you can prepare a dedicated dynamicView and call the performFind with on result a database optimisation.
Thanks to Leila Mekika for this proposal and patch
On the widget-form.xsd definition, the element on-field-event-update-area haven't possibility to define some parameters.
But on java code, the on-field-event-update-area is read like on-event-update-area.
If you put some parameters on your code, your editor raise a syntax error but OFBiz analyse and execute it well.
<wf:field name="reload" >
<wf:submit/>
<wf:on-field-event-update-area event-type="click"
area-target="ReloadIt">
<wf:auto-parameters-service service-name="computeForReload" send-if-empty="false"/>
</wf:on-field-event-update-area>
</wf:field>
By the way we can synchronize the on-field-event-update-area xsd on on-event-update-area.
When you define a display-entity you have the possibility to add a sub-hyperlink related to the element displayed.
<field name="partyIdFrom">
<display-entity entity-name="PartyNameView" key-field-name="partyId" description="${groupName}${firstName} ${lastName}">
<sub-hyperlink target="viewprofile" description="view">...</sub-hyperlink>
</display-entity>
<field>
This display the party name with a link "view" connected.
When you use the name as link without a dedicate sub link, you need to change all the form to resolve the information to display for creating an hyperlink
<row-actions>
<entity-one entity-name="PartyNameView" value-field="partyName">
<field-map field-name="partyId" from-field="partyIdFrom"/>
</entity-one>
<set field="partyNameValue" value=" ${partyName.groupName}${partyName.firstName} ${partyName.lastName}"/>
</row-actions>
<field name="partyIdFrom">
<hyperlink target="viewprofile" description="${partyNameValue}">..</hyperlink>
</field>
We lost the advantage of the display-entity. With this case, we improve display-entity with the following rule :
If the display-entity has a subhyperlink and the subhyperlink haven't description, the description of the link is the display-entity description.
In the code, if a sub-hyperlink has an empty description, we convert the display entity as a hyperlink
Adds <img> and <hr> to CustomSafePolicy, removes obsolete <tt>. <img> allows
only attributes src and alt.
Both <br> and <br /> are correct. For that, this rather uses
TagBalancingHtmlStreamEventReceiver
Thanks: Ingo Wolfmayr
I noticed that JpegImageParser from Apache Commons Imaging never had a write
option. So I commented it out. I tested uploading, it's OK
org.apache.axiom.om.impl.builder.StAXOMBuilder has been replaced by
org.apache.axiom.om.OMXMLParserWrapper
in SOAPEventHandler.java
The rest of information is in the main build.gradle
I got 2 test errors on Win7. I'll see how it goes on GH and BB.
Maybe it's write.lock issues with Lucene or/and Solr indexes
Allows both <br> and <br /> to pass in UtilCodec::checkStringForHtmlSafe, both
are correct.
Clarifies owasp.properties documentation about how to create own sanitizer
policies
When you use two menus where the second extend the first, menu items and menu links aren't correctly propagated.
The menu items and menu links presents on the second menu already have the first menu on their model.
****
<menu name="FirstMenu" extends="CommonInlineBarMenu" extends-resource="component://common/widget/CommonMenus.xml">
<menu-item name="MyItem">
<link target="GoAction"/>
</menu-item>
</menu>
<menu name="SecondMenu" extends="FirstMenu"/>
****
The result, if during the rendering some information are generated from the menu, in the previous case, it's always the "FirstMenu" that would be use.
Like when your menu generate a hidden-form, the SecondMenu link the bad form
****
<form method="post" action="GoAction" onsubmit="javascript:submitFormDisableSubmits(this)" name="SecondMenu">...</form>
<a href="javascript:ajaxSubmitFormUpdateAreas('FirstMenu', 'xxx')">MyItem</a>
****
To solve it and don't break the thread safe pattern, I introduce two new constructor for ModelItem and MenuLink for duplicate the ModelMenuItem and MenuLink in memory with the new parent. With this, the SecondMenu iw now completely duplicated on memory and now share any reference with the extended menu.
Thanks to Marco Rodrigues that detect this problem
We need to upload a CSV format file as part of project requirement
We were able upload CSV format file under eCommerce in Version 16.11.07.
We are trying to implement the same in version 18.12.05 - there the same upload
module does not work.
jleroux: I missed to check and allow CSV files when all files are allowed.
That now uses:
https://commons.apache.org/proper/commons-csv/apidocs/org/apache/commons/csv/CSVFormat.html
The default CSV format used to check upload of CSV files is set in the property
csvformat=CSVFormat.DEFAULT in security.properties
Thanks: Sachin for report
Add integration test to validate the good retrieval of the success /
error message.
Ajout de 4 services groovy pour tester le fonctionnement du moteur de service en groovy couplé a des appels de type DSL
No functional changes, just removing a compilation warning
While compiling with Java 11 I got this message:
> Task :compileJava
UtilHttp.java:502: warning: [unchecked] unchecked call to
<R>map(Function<? super T,? extends R>) as a member of the raw type Stream
[...]
This fixes it with the help of Eclipse
rs.getModelService().getName() should be used
instead of
rs.getModelService().name
The rest of changes is only non functional formatting and such
Thanks: Emad Radwan for reporting
At this time when you aren't logged and you need to be authenticated for access to a page, OFBiz return the login page with a http code 200
This set a problem for ajax call to understand why the page returned isn't the attendee/
This improvement does 3 things :
* return a HTTP status code 401 (Unauthorized) in LoginWorker::checkLogin if user is not authenticated (no more 200),
* in common-theme, OfbizUtil.js, on AJAX calls handler, if the request fails with a 401 status code, reload current page (so we land on login form instead of being stuck in a blank modal) with a new search param `clickOn` containing the id of the link that triggered the AJAX call,
* on page load, if `clickOn` search parameter exists, trigger a click event on the link, so the initial modal pops in after a successful login
Thanks to Florian Motteau for this improvement
When you forward a request-map on json response after a service call like this :
<request-map uri="updateMyEntity">
<security https="true" auth="true"/>
<event type="service" invoke="serviceWithUnserializableElement"/>
<response name="success" type="request" value="json"/>
<response name="error" type="request" value="json"/>
</request-map>
The request json works fine if the serviceWithUnserializableElement have an element unserializable on out put at the first level
<service name="serviceWithUnserializableElement"...>
<attribute name="outputStream" type="java.io.OutputStream" mode="OUT"/>
</service>
If the definition is like this
<service name="serviceWithUnserializableElement"...>
<attribute name="outputStreamMap" type="Map" mode="OUT"/>
</service>
The json failed to generate if the outputStream is a map. despite the function UtilHttp.getJSONAttributeMap that safe only the first map level and don't work in deep.
By the way, we improved the getJSONAttributeMap to work in deep by a recursive treatment on Map and List.
The LookupProduct function is used across various applications,
intended to assist users with the need to search, find and select
products in forms where one needs to be added or changed.
Also usable in overviews where a product is referenced.
modified: CommonUiLabels.xml
When you define a controller request-map with an event of type 'service-multi', if your uri contains multiple allocation like 'MyWay/MyAction' the class ServiceMultiEventHandler failed to execute with an EventHandlerException
*****
<request-map uri="Payment/QuickSend">
...
<event type="service-multi" invoke="quickSendPayment"/>
...
*****
The reason comes from the necessary to resolve the attribute global-transaction on event definition, and to do that a call to ConfigXMLReader is realized.
But unnecessary because we already have the event element on the context.
Use it directly, simplify the code and fix this issue
When importing an entity with "${" in for at least an element it's rejected
because of the security check done to protect from Freemarker unauth attacks
(see OFBIZ-12594).
As suggested by Ingo, allowing users with appropriate permissions seems an
usable solution. We still need to define the "appropriate permissions".
We can start with OFBTOOLS and WEBTOOLS, as it's reported by Ingo, and add
others later if they ever come.
Thanks: Ingo Wolfmayr for report and suggestion
The previous commit for OFBIZ-12594 was only working on Windows. On *nix OSs
there is no way to reliably get "--test" String from java.class.path property.
Also the previous fix was brittle because relying only on 1 space separating
words.
This fix puts in the SolrDispatchFilter system property at the beginning of the
4 Solr tests and removes it at end of them. That presence can reliably be tested
in ControlFilter that is called before SolrDispatchFilter. It allows to bypass
SecurityUtil::containsFreemarkerInterpolation that would else change the
parameters content type that must be application/x-www-form-urlencoded.
content
Thanks: Tom Pietsch for report and Mart Naum for confirmation
I did not catch an issue put in by this feature because BuildBot is not running
for few days (see INFRA-23076) and i don't always run tests locally (relying on
BuildBot and GH actions don't run tests).
This is the error Solr tests throw else:
<<Unfortunately, the stream was empty / not available. This may be caused by
another servlet filter calling ServletRequest.getParameter*() before
SolrDispatchFilter>>
Got an issue with previous commit (I guess confusion with 22.01)
I did not catch an issue put in by this feature because BuildBot is not running
for few days (see INFRA-23076) and i don't always run tests locally (relying on
BuildBot and GH actions don't run tests).
This is the error Solr tests throw else:
<<Unfortunately, the stream was empty / not available. This may be caused by
another servlet filter calling ServletRequest.getParameter*() before
SolrDispatchFilter>>
UtilProperties::setPropertyValueInMemory was only based on files. Thinking by
analogy, as Pierre pushed SystemProperties with OFBIZ-6189, I thought that by
adding an UtilProperties::setPropertyValueInMemory based on
EntityUtilProperties::getProperties it would resolve the issue. But it did not.
Looking closer at the code, I wondered why UtilProperties::setPropertyValueInMemory
was used at all.
This fixes the issue by simply removing setPropertyValueInMemory and setting "Y"
or "N" when calling testInvoicePerShipment.
It though keeps the new UtilProperties::setPropertyValueInMemory variant
OFBIZ-12587 is a definitive solution to prevent any kind of Freemarker exploits.
But it's hard to realise because OFBiz exposes objects, like attributes from the
Servlet scopes. So in the meantime preventing Freemarker interpolation in fields
is a pragmatic solution.
This is an improvement but needs to be backported because it kinda affects
security
The empty string causes a NullPointerException, because in the WidgetWorker
returns only an anchorElement if the description of the hyperlink is not empty.
Solution: If the anchorElement is null, the line is simply not executed:
Thanks: Tom Pietsch
For the next demo to work we need to set the host-headers-allowed to
demo-next.ofbiz.apache.org instead of demo-old.ofbiz.apache.org
Thanks to Drew Foulks for handling the Infra part for us
Changes name="upload_file_type_bogus" in EditCategory.ftl and
EditProductContent.ftl to name="up_load_file_type_bogus"
The last line of deniedWebShellTokens in SecuredUpload and similarly in
SecurityUtilTest classes should no have a comma and anti-slash as previous lines.
Also logs when an image contains one of the token in deniedWebShellTokens
Demo content website cmssite/cms could not be accessed because in this case
requestUri is null. Like login request it does not need auth, I did not dig
further, here is a simple fix.
Removes non satisfying last line (because images may contain those strings) in
security.properties and SecurityUtilTest.java
In SecuredUpload, renames deniedFileExtensions and deniedWebShellTokens to
respectively getDeniedFileExtensions and getDeniedWebShellTokens
Adds <<",","+",',','+'>> to deniedWebShellTokens as an obviously non satisfying
(because images may contain those strings, I checked) temporary solution before
looking at Freemarker::WhitelistMemberAccessPolicy as suggested by Matei
Thanks to Matei "Mal" Badanoiu for reporting this post-auth vulnerabily
A user with rights to modify and/or create websites may insert malicious HTML
elements in the “webappPath” parameter from content/control/EditWebSite
resulting in XSS.
In order to trigger the XSS a victim needs to navigate to main page of the
modified website (eg webpos or ecommerce) and interact with the malicious
HTML elements (eg trigger the “onmouseover” event by navigating with the mouse
over the “form” and/or “a” tags).
Thanks to Matei "Mal" Badanoiu for reporting this post-auth vulnerabily
This was already fixed but we can do better by using SecuredUpload::isValidText
Also grabs some tokens to security.properties::deniedWebShellTokens from
DataEvents.java, and adds "alert" even it's harmless as is, as it's often used
by attackers to demonstrate issues, so will earn time.
Though an improvement, I backport as it's related to security