Commit Graph
10163 Commits
Author SHA1 Message Date
Pierre Smits eea0198835 Improved: Currency Data for China
(OFBIZ-11629)

improved description
2020-05-04 17:33:52 +02:00
Jacques Le Roux fde21d0b10 reverted: CLONE - Use only HTTPS in OFBiz
(OFBIZ-11643)

Reverted, this needs more work
2020-05-04 13:21:03 +02:00
Jacques Le Roux a8c5c84cec Fixed: CLONE - Use only HTTPS in OFBiz
(OFBIZ-11643)

When doing OFBIZ-6849 I forgot to take care of the https attribute of the
security element used in controllers.

It's not used anymore since we used HTTPS everywhere but in request listed in
http.request-map.list property of url.properties. It's even enforced by HSTS for
requests that are not listed in this property.

This removes the https attribute and removes its usage in in controllers.
2020-05-04 13:10:17 +02:00
Jacques Le Roux 3f60efb343 Improved: Improve ObjectInputStream class
(OFBIZ-10837)

While working on OFBIZ-11633 I crossed an issue in R18 (not in trunk) where
objects from org.apache.commons.fileupload (namely DiskFileItem and
FileItemHeadersImpl) are not serializable.

While at it I decided to handle at the SafeObjectInputStream level
the "fileItems" case I already crossed with, OFBIZ-11534, in RequestHandler

It has an inconvenient in R18 (not in trunk) where ObjectInputStream can't
handle a null class (of course) and so return a benign exception in log (only).

I believe it's better to handle these specific cases at the lower possible
level in all supported branches.
2020-05-02 12:34:56 +02:00
Jacques Le Roux 1efaa73ebb Fixed: PartyProfileContent.js does not work
(OFBIZ-11633)
When you upload a content from the party profile page you don't see a progress
bar. The PartyProfileContent.js is loaded but for some reason is unused or wrong

Mohammad Kathawala mentionned that it was removed with OFBIZ-9299
It was also broken with OFBIZ-11402

Thanks: Mohammad for the track
2020-05-02 09:31:54 +02:00
Pawan Verma ffe9c46cf0 Improved: Used utility provided by OFBizTestCase class for userLogin instead of fetching from DB test cases also removed unused fetching of userLogin in some cases
(OFBIZ-11618)
2020-04-30 22:00:04 +05:30
Suraj Khurana f637e3c5fe Improved: Converted all EntitySyncInclude services from simple to entity-auto (#84)
* Improved: Converted all EntitySyncInclude services from simple to entity-auto
(OFBIZ-11613)
2020-04-30 13:14:26 +05:30
Pawan Verma 1b3d3bdf4e Improved: Added support for EntityQuery methods in OFBiz integration tests.
(OFBIZ-11247)

Thanks: Jacques for the review.
2020-04-29 15:28:42 +05:30
Jacques Le Roux 61e5435b30 Fixed: "entity/list" request is not handled well
(OFBIZ-11593)

The "entity/list" request has been put in with OFBIZ-11007. It's used to call
the entitymaint view and so is a demo/didactic duplicate of entitymaint request.
It's only used in FindGeneric screen (look for WebtoolsBackToEntityList label).
It's problematic because since the CSRF token defense was put in you can no
longer filter the entities from the entities list screen, even when the default
NoCsrfDefenseStrategy is used. It works if you use the entitymaint request
instead.

2020-01-19 I proposed in OFBIZ-11306 a solution for such cases.
It was not used because 2020-02-14 I thought it was no longer needed.
It was necessary for this case and implemented with commit e487122.

But as, Rohit Koushal reported, it breaks some functionalities like adding
address/update address during Quick Finalize Order. The issue can also be
reproduced in ecommerce when trying the same while checking out, or quick
checking out, an order.

More generally the error is of this kind:
|27.0.0.1-8009-exec-3 |ControlServlet                |E| Error in request handler:
java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
  at java.util.LinkedList.checkElementIndex(LinkedList.java:555) ~[?:1.8.0_252]
  at java.util.LinkedList.get(LinkedList.java:476) ~[?:1.8.0_252]
  at org.apache.ofbiz.webapp.control.RequestHandler.getRequestUri(RequestHandler.java:837) ~[main/:?]

and happens with URLs like
updateCheckoutOptions/editcontactmech?DONE_PAGE=checkoutoptions&contactMechId=9015
or
updateCheckoutOptions/editcontactmech?preContactMechTypeId=POSTAL_ADDRESS&
contactMechPurposeTypeId=SHIPPING_LOCATION&DONE_PAGE=checkoutoptions

So I decided to revert the concerned part of commit e487122 and to rather use
entitymaint instead of "entity/list" request.
2020-04-29 08:29:33 +02:00
Pawan Verma 1e05f0c72d Incorrect column alias in EntitySQLProcessor for sql query working with mysql
(OFBIZ-11573)

More details: Method getColumnLabel returns the designated column's suggested title for use in printouts and displays. Method getColumnName returns the designated column's name.

Thanks: Suraj and Jacques for the review.
2020-04-28 10:54:57 +05:30
Jacques Le Roux ec23f8b61f Fixed: Compound-widget not works with condition
(OFBIZ-11606)

Fixes "<**:condition" not well managed and generating an error

Changes all the getNodeName() by getLocalName() in the ModelX****Condition.java

Thanks: Olivier
2020-04-27 17:43:38 +02:00
Jacques Le Roux d7c42e3b8c Fixed: Compound-widget not works with condition
(OFBIZ-11606)

rootElement is not correct for a compound file, it's necessary to do a
UtilXml.firstChildElement(rootElement, "forms"); to be correct.
It's done for screen, form but not for grid !

So correction is now added the correct read of rootElement.

Thanks: Olivier
2020-04-27 14:31:31 +02:00
Jacques Le Roux e8e9db5b1a Improved: Prevent recurring errors block due to generateTokenForNonAjax
(OFBIZ-11609)

Fixes check style. I removed a space after a cast. That's how I wrote it so
far and that was wrong. BTW I did not invent it, our code is riddled of it:/

https://www.oracle.com/technetwork/java/javase/documentation/codeconventions-141388.html
2020-04-27 14:29:14 +02:00
Jacques Le Roux faf2827e67 Improved: Prevent recurring errors block due to generateTokenForNonAjax
(OFBIZ-11609)

Fixes the if(test): toString() is not the same than getCanonicalName()

Also while at it, in case of exception, uses NoCsrfDefenseStrategy as default
2020-04-27 12:36:17 +02:00
Jacques Le Roux cdb40c3d31 Improved: Prevent recurring errors block due to generateTokenForNonAjax
(OFBIZ-11609)

Fixes check style issues
2020-04-26 14:21:59 +02:00
Jacques Le Roux 1ff79ec566 Improved: Prevent recurring errors block due to generateTokenForNonAjax
(OFBIZ-)

After the VM demos crash yesterday, I had a look at the log of trunk demo and
found a lot of recurring errors block due to CsrfUtil::generateTokenForNonAjax.

It's not a big deal but it's annoying to have such useless errors cluttering the
logs
2020-04-26 12:38:05 +02:00
Jacques Le Roux 5428a73399 Improved: Increase the size of http.upload.max.sizethreshold
(OFBIZ-11598)

The http.upload.max.sizethreshold size is curently sets to 10240 (10KB) and that
seems small nowadays to me. We could use 1MB.

Also moves mail.spam.name in its mail block

Thanks: Pawan for review
2020-04-26 10:13:09 +02:00
ravilodhiandRavi Lodhi ae70318fc8 Improved: Added support to consider non-default transaction timeout for Groovy and Simple event handlers.(OFBIZ-11607) (#77)
* Improved: Added support to consider non-default transaction timeout for Groovy and Simple event handlers.(OFBIZ-11607)

* Revert "Improved: Added support to consider non-default transaction timeout for Groovy and Simple event handlers.(OFBIZ-11607)"

This reverts commit 934eaa4539.

* Improved: Added support to consider non-default transaction timeout for Groovy and Simple event handlers.(OFBIZ-11607)

Co-authored-by: Ravi Lodhi <lodhiravi1@gmail.com>
2020-04-26 09:17:30 +02:00
Jacques Le Roux df52f733b3 Improved: Update build.gradle to the latest dependencies
(OFBIZ-11603)

Checkstyle is a game where you can't never win.
And the result (formatting) is sometimes ugly, it's a pain!
2020-04-21 17:31:27 +02:00
Jacques Le Roux ef097c7a9a Improved: Update build.gradle to the latest dependencies
(OFBIZ-11603)

Replaces deprecated calls
2020-04-21 15:49:00 +02:00
Jacques Le Roux a721ba7557 Documented: fixes wrong indentations 2020-04-20 18:57:58 +02:00
Jacques Le Roux d0144d96e1 Improved: Increase the size of http.upload.max.sizethreshold
(OFBIZ-11598)

That's rather refactoring to avoid to have the size hardcoded in several places
Next: ask if it's OK for everyone to increase the size
2020-04-19 15:41:10 +02:00
Jacques Le Roux 6d3d8f73c2 Fixed: Error in uploading very large files, ie >2MB
(OFBIZ-11534)

This was not supposed to be committed, actually (wrong) part of OFBIZ-11597
2020-04-16 16:02:20 +02:00
Jacques Le Roux 4725ae68d8 Fixed: Error in uploading very large files, ie >2MB
(OFBIZ-11534)

There is an issue in uploading large files, I am able to upload files up to 2 GB
successfully but getting an error when trying to upload a file larger than 2GB.

Example -
1. Go to party profile -
https://demo-trunk.ofbiz.apache.org/partymgr/control/viewprofile?partyId=admin
2. Try to create a party content with a file larger than 2 GB
3. Error on console

jleroux:
For a 2GB+ file you need to set Xmx to more than the double of the file size,
eg: gradlew ofbiz -PjvmArgs="-Xms1024M -Xmx5048M"

You then get another small issue (only in log) when redirecting to send the
partyId parameter.

This is because, DiskFileItem is a temporary Object with a null value contained
in "fileItems" attribute. It can't be detected by UtilMisc::makeMapSerializable
and that makes "fileItems" not serializable. So it must be removed from
reqAttrMap.

Thanks: Chandan Khandelwal for report, Michael for suggesting a very large file
to upload
2020-04-16 15:46:09 +02:00
Jacques Le Roux 07a472f89c Documented: improves security.properties documentation 2020-04-15 19:31:51 +02:00
Jacques Le Roux fdb995fd50 Documented: adds CSRF defense and updates password and JWT 2020-04-15 19:30:53 +02:00
Jacques Le Roux d8025d41dc Improved: Add security.internal.sso.enabled and security.token.key
SystemProperties

(OFBIZ-11594)(OFBIZ-11470)

After adding more latitude to set same site by using
EntityUtilProperties::getPropertyValueFromDelegatorName for retrieving the value
possibly from the DB as a SystemProperty, adds the value as strict in
SSOJWTDemoData.xml
2020-04-15 15:15:13 +02:00
Jacques Le Roux 98f6d7ea8d Improved: Internal SSO: adds more time to compensate for possible time difference 2020-04-15 15:08:43 +02:00
Jacques Le Roux e0c8a1f4b0 Fixed: 'FindJob' generates an error
(OFBIZ-11590)

This is due to OFBIZ-11402. Handling a converter for java.time.ZoneRegion is
complicated. Adding a toString() is enough.

Also 2 automated formatting while at it...
2020-04-14 13:42:11 +02:00
Jacques Le Roux 01e98b5b5f Improved: Add security.internal.sso.enabled and security.token.key
SystemProperties

(OFBIZ-11594)

Adds more latitude to set same site by using
EntityUtilProperties::getPropertyValueFromDelegatorName for retrieving the value
possibly from the DB as a SystemProperty.

OF course this would not work with tenants, but I doubt the "internal" SSO
feature will ever be use in a tenants context
2020-04-13 17:25:25 +02:00
Jacques Le Roux ff9335ac8c Improved: Add security.internal.sso.enabled and security.token.key
SystemProperties

(OFBIZ-11594)

This comes handy when testing, from examples component, the internal SSO feature
which allows a token based login between OFBiz instances

The SSOJWTDemoData.xml inadvertently slipped in w/ previous commit
2020-04-13 12:14:48 +02:00
Jacques Le Roux e1988a29c8 Improved: moves "10 seconds" comments from security.properties to CommonEvents.java
Also removes trailing blanks in security.properties
2020-04-13 11:40:58 +02:00
Jacques Le Roux 03780e4665 Fixed: "entity/list" request is not handled well
(OFBIZ-11593)

Fixes the resolveURIBasicOverrideView test
2020-04-13 11:38:04 +02:00
Jacques Le Roux ed410dfd68 Fixed: "entity/list" request is not handled well
(OFBIZ-11593)

The FilterEntities widget form is also an issue because it's a POST form and
"entity/list" request use the GET method. Using "entitymaint" as target works
(POST by default)
2020-04-12 13:59:25 +02:00
Jacques Le Roux e487122624 Fixed: "entity/list" request is not handled well
(OFBIZ-11593)

The "entity/list" request has been put in with OFBIZ-11007. It's used to call
the entitymaint view and so is a demo/didactic duplicate of entitymaint request.
It's only used in FindGeneric screen (look for WebtoolsBackToEntityList label).
It's problematic because since the CSRF token defense was put in you can no
longer filter the entities from the entities list screen, even when the default
NoCsrfDefenseStrategy is used. It works if you use the entitymaint request
instead.

Anyway, 2020-01-19 I proposed in OFBIZ-11306 a solution for such cases.
It was not used because 2020-02-14 I thought it was no longer needed,
but it's necessary for this case, and maybe others not already detected.

Here it's implementation (only trunk)
2020-04-12 13:17:37 +02:00
Jacques Le Roux 7958d6d55d Fixed: Updates checkstyleMain.maxErrors to fits with Buildbot report
Never ever install Eclipse Checkstyle plugin. It does not use the same version
than Gradle, it's then a mess (Eclipse's is newer).

Fixes issues in CsrfUtilTests.java
2020-04-06 19:23:14 +02:00
Jacques Le Roux b95fa36bf4 Improved: follow checkstyle conventions in files committed for CSRF token defense
Mostly manually-automated, so some changes are not perfect. I have manually
changed back excessive ones

Comments out ArrayTypeStyle checkstyle
Updates checkstyleMain.maxErrors
2020-04-06 12:05:16 +02:00
Jacques Le Roux ddb8f4273a Improved: replaces module by MODULE everywhere 2020-04-05 19:46:34 +02:00
Jacques Le Roux ab9b048d07 Improved: fixes a Javadoc issue 2020-04-05 12:29:47 +02:00
Jacques Le Roux ba707d45be Implemented: POC for CSRF Token
(OFBIZ-11306)

Simple strategy is to rely on SameSite 'strict' value in SameSiteFilter in all
supported branches. No backport needed with the changes here.

Thanks: James for all the good work we did together :)
2020-04-05 11:29:40 +02:00
Jacques Le Roux 05354b73b7 Improved: prevent [rawtypes] found raw type: List at RequestHandler.java:89 2020-04-04 19:40:26 +02:00
Jacques Le Roux e0f0d5271a Fixed: Prevent Host Header Injection (CVE-2019-12425)
(OFBIZ-11583)
2020-04-04 19:32:02 +02:00
Jacques Le Roux 645d419574 Merge branch 'trunk' into POC-for-CSRF-Token-OFBIZ-11306 2020-04-04 17:52:06 +02:00
Jacques Le Roux 768353a093 Improved:
Implemented:
Documented:
Completed:
Reverted:
Fixed:

(OFBIZ-)
Explanation
Thanks:
2020-04-04 15:49:49 +02:00
Jacques Le Roux c9d516d367 Fixed: The createTaskContent request does not work
(OFBIZ-11246)

It seems that same request can not be parsed multiple times if it has multi part
object in it as the parse method remove it after that.

Found one stackoverflow link around the same:

https://stackoverflow.com/questions/13881272/
servletfileuploadparserequestrequest-returns-an-empty-list

I believe that all places/uploads using this workflow should resulting the same
issue.

One possible solution I could think of without going with new approach is to set
list of file Items into the request attribute and use it if parse method remove
it and unable to retrieve on 2nd call.

Thanks: Ankush Upadhyay for the analysis and initial patch. I only slightly
modified it.
2020-04-04 15:49:43 +02:00
Jacques Le Roux e666c65b7c Improved: Improve Web Content Caching
(OFBIZ-11477)

According to OWASP OFBiz Web Content Caching is weak:

Independently of the cache policy defined by the web application, if caching web
application contents is allowed, the session IDs must never be cached, so it is
highly recommended to use the Cache-Control: no-cache="Set-Cookie, Set-Cookie2"
directive, to allow web clients to cache everything except the session ID

I though noticed that Set-Cookie2 is deprecated for a long time now. And we new
browsers policies it to often updated. So no need to use Set-Cookie2.
2020-04-04 15:49:43 +02:00
Pawan Verma 4d2e5d3e26 Fixed: Specified key was too long; max key length is 767 bytes for ProductPromoCodeEmail entity.(OFBIZ-5426) (#44)
* 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.
2020-04-04 15:49:41 +02:00
Jacques Le Roux 43f46399ff Improved: Added unit testing, using JMockit, to ensure that form macros are
rendered using ids from ModelFormField#getCurrentContainerId.

(OFBIZ-4035)

Fixes check style errors
2020-04-04 15:49:41 +02:00
Jacques Le Roux c68d43efa2 Improved: Added unit testing, using JMockit, to ensure that form macros are
rendered using ids from ModelFormField#getCurrentContainerId.

(OFBIZ-4035)

Fixes an issue due to Eclipse automated import organisation.

There are still check style errors
2020-04-04 15:49:41 +02:00
Jacques Le Roux d1ca68c166 Improved: Added unit testing, using JMockit, to ensure that form macros are
rendered using ids from ModelFormField#getCurrentContainerId.

(OFBIZ-4035)

Fixes a check issue (line too long)

Notice: on Windows I get 20 errors when compiling:
> Task :compileTestJava FAILED
C:\projectsASF\Git\ofbiz-framework\framework\widget\src\test\java\org\apache\
ofbiz\widget\renderer\macro\MacroFormRendererTest.java:134:
error: annotation type not applicable to this kind of declaration
        @Mock
        ^
I guess the change in build.gradle are not enough for Windows, to be seen later...
2020-04-04 15:49:41 +02:00