When we try to quick ship entire order from the Order Manager, the following
error is thrown (in some cases, specifically when we have added a telecom number
for the customer
This was broken by OFBIZ-11462
Thanks: Priya Sharma
2020/08/10 the OFBiz security team received a security report by Harshit Shukla
<harshit.shukz@gmail.com>, roughly it was (quoting part of it to simplify):
<<I have identified a Remote Code Execution (RCE) Vulnerability. The reason
behind this RCE is lack of file extension check at
catalog/control/UploadCategoryImage?productCategoryId=CATALOG1_BEST_SELL&pload_file_type=category>>
Using this post-auth RCE in OFBiz demos, Harshit was able to get some AWS
credentials by uploading a webshell (based on [0]).
By security, it was then decided by the Infra and OFBiz security teams to shut
down the demos.
After discussing the elements reported with Mark J Cox (VP of ASF security team)
we in common decided that no CVE was necessary.
This is a bug because the behaviour is not assured on Windows for instance. So
it's impossible to correctly develop and test.
As explained at
https://docs.oracle.com/javase/8/docs/api/java/io/File.html#renameTo-java.io.File-
<<Many aspects of the behavior of this method are inherently platform-dependent:
The rename operation might not be able to move a file from one filesystem to
another, it might not be atomic, and it might not succeed if a file with the
destination abstract pathname already exists. The return value should always be
checked to make sure that the rename operation was successful.
Note that the Files class defines the move method to move or rename a file in a
platform independent manner.>>
So the expression
file.renameTo(file1)
used in 5 Application Product Groovy scripts can be easily replaced by
Path source = file.toPath()
Files.move(source, source.resolveSibling(filenameToUse))
that is working on all platforms as explained at
https://docs.oracle.com/javase/8/docs/api/java/nio/file/Files.html#
move-java.nio.file.Path-java.nio.file.Path-java.nio.file.CopyOption...-
The sendFrom emailAddress had the unnecessary comma prefix. The sendTo emailAddress list was a list of lists instead of list of strings.
Also affected sendOrderDeliveryScheduleNotification minilang service. <string-append> tag was used with comma prefix for sendFrom emailAddress, since the sender would only be one used <set> tag without any prefix instead.
sendTo field was wrongly being fetched from PartyAndContactMech view to get emailAddress, replaced it with the correct entity field infoString.
Thanks: Jacques for input.
There are some inconsistencies in the code for string comparison statusId.equals(PRUN_COMPLETED) whereas it should be written as PRUN_COMPLETED.equals(statusId) cause the former can throw NullPointerException if the variable found to be NULL.
Thanks: Devanshu for your contribution.
At 0da10ea897, We converted deleteProductGroupOrder service from XML to Groovy, which generates this issue.
Reimplemented full groovy service to remove releated records.
Sometimes use wrong type castings for BigDecimal:
I have observed that for typecasting in groovy, we have used the wrong coding
pattern like
(BigDecimal) 0
It should be like
0 as BigDecimal
Note that this does not apply to decimal because in case of decimal, the default
type is always BigDecimal in Groovy.
Thanks: Pritam Kute for spotting the issue in OFBIZ-11843
OFBIZ-11436 broke the uploadProductAdditionalViewImages service but something
else remains which prevents to create a content
Thanks: Arpit Mor for report
In PR#150 Pierre Smits suggested to move this new Groovy files updir:
"There is no need to have subfolders defining where the services belong to when
such is already captured in the name of the file, e.g.:
folder /shipment/receipt/ when the filename has ShipmentReceiptServices.groovy
Similarly
/shipment/issuance/ when the filename has ShipmentIssuanceServices.groovy"
* Improved: Convert ShipmentReceiptServices.xml mini lang to groovy
(OFBIZ-11468)
Also converted getTotalIssuedQuantityForOrderItem in IssuanceServices, because it is used in ShipmentReceiptServices and needed more return values.
* split to long lines
Co-authored-by: Wiebke Pätzold <Wiebke.Paetzold@ecomify.de>
* [Improved]: Use GroovyBaseScript's logging utility methods instead of using Debug
- Replaced the debug.log methods with the respective groovy utility method
- Enhanced the GroovyBaseScript to entertain the fetch the current class name as the module name for logging
- Overloaded the logError method to entertain throwbale object for better logging
- Removed unused import statements and module variables.
(OFBIZ-11762)
* [Removed]: Extra line spaces. (OFBIZ-11762)
* [Revert]: Unwanted changes. (OFBIZ-11762)
* [Added] Same changes to these files. (OFBIZ-11762)
Co-authored-by: Priya Sharma <priya.sharma@example.com>
(OFBIZ-11591)
Side effect: Inventory Issuance use generic shipment service to control the authorization
but without a shipment, checkCanChangeShipmentStatusGeneral failed with NPE.
I complete the function to escape if a shipment isn't present and only valid with facility permission
* Improved: Make shipment services loosely coupled with work-effort generation.
(OFBIZ-11678)
Removed workeffort generation related code in separate service, in createShipment and updateShipment service. In this effort, createShipment has been successfully changed to entity-auto as well.
Thanks: Pierre Smits and Arun Patidar for discussion and review.
(OFBIZ-11403)
It works on stable demo which uses 2.4.13 instead of 2.5.11 for trunk.
I guess it's because since Groovy 2.5 DateTimeFormatter, introduced with Java 8,
is used underneath.
This fixes and improves it regarding localisation. Because it's easier with
DateTimeFormatter and LocalDateTime to handle localisation
(OFBIZ-11701)
The service getAssociatedPriceRulesConds return some element to help the selection on product prise rule condition screen.
The problem: all query to resolve element are realized without filter :
from("Product").queryList()
On big database, a call on this service generate a server saturation (load 1 Million product to a dropdown, isn't logical)
To keep the benefit of this service as example to implement a custom service with filter, I introduce a limit range to 200. For much more it's better to improve the screen with a lookup.
I also simplify the list generation to homogenize and help the reader.
present in ecommerce
(OFBIZ- OFBIZ-6110)
OFBIZ-10031 and OFBIZ-8579 did not take care of that. It seems that, for a
reason, fixing OFBIZ-11620 mades them popup
(OFBIZ-11620)
It was initially broken by OFBIZ-9905 so only trunk was concerned.
The fix is simple: there should be no space at the beginning of the file.
But then, when running the test suite, other issues raise.
I guess they were hidden because of the initial issue.
OFBIZ-10231 introduced 2 issues
A syntax error:
product.removeRelated("ProductKeyword", product)
instead of
product.removeRelated("ProductKeyword")
A wrong usage of storeByCondition
This fixes the 3 issues, to test:
gradlew "ofbiz --test component=product --test suitename=producttests"
Thanks: Pawan for initial report
* Fixed: Specified key was too long; max key length is 767 bytes for ProductPromoCodeEmail entity.
(OFBIZ-5426)
The problem is in the entity model. An email address should not be used in the primary key - mainly because an email address is case-insensitive. A better design would be to use the email address contact mechanism ID in the primary key.
Done Following:
1. Changed Entity Name from ProductPromoCodeEmail to ProductPromoCodeContMech
2. Related Changes for the entity name change
3. Migration service to migrate old data
Thanks, Leon for the report and Adrian Crum, Jacques Le Roux, Ingo Wolfmayr, Deepak Dixit, Pierre Smits and Gil Portenseigne for the discussion and review.
* Improved: Added new line in service definition file and lincence in MigrationServices file.
(OFBIZ-5426)
Thanks, Jacopo for the review.
(OFBIZ-10231)
After groovy conversion the method productPriceGenericPermission failed to validate a user
Problem due to bad call on hasEntityPermission instead of hasPermission
(OFBIZ-10231)
After groovy conversion the method checkProductRelatedPermission
has been broken for other minilang method that didn't converted.
To solve this problem, I created new permission service checkProductRelatedPermission
and convert all previous minilang method call by a permission service on the related service call
(OFBIZ-10231)
No functional change
This commit contains multiple refactoring to decrease code quantity :
* use groovy syntax for empty/not empty value
* use kelvin syntax
* exploit DSL syntax and EntityQuery as possible
* refactoring redundant "if block"
* remove unnecessary transfer variable
Thanks to Gil Portenseigne for help my as his second eye
(OFBIZ-8341)
In many Java and Groovy files we have auto generated catch blocks or empty catch
blocks.
To avoid such exception swallowing this should be improved to at least log the
error and also return error in case of service.
Missed this one in last commit
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1866985 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-8341)
In many Java and Groovy files we have auto generated catch blocks or empty catch
blocks.
To avoid such exception swallowing this should be improved to at least log the
error and also return error in case of service.
Last ones :)
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1866958 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-11182)
The entity PicklistStatusHistory record each status change realized on picklist.
It can't be convert to entity-auto easily because PicklistStatusHistory's fields pattern
doesn't follow same entities like ShipmentStatus and PartyStatus.
To solve this issue, I deprecate PicklistStatusHistory and move it to OldPicklistStatusHistory
and replace it by new entity PicklistStatus that can use natively with entityauto.
I added a new migration service migrateOldPicklistStatusHistoryToPickListStatus to forward all
picklist status history to new entity.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1866558 13f79535-47bb-0310-9956-ffa450edef68