Commit Graph
1074 Commits
Author SHA1 Message Date
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 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
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 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 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 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 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 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 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 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
Jacques Le Roux 866c742e8f Fixed: Ensure that the SameSite attribute is set to 'strict' for all cookies.
(OFBIZ-11470)

It's better to allow users to change from strict to lax, at least for all
cookies. Some could want to change it by cookie type. I let the exercise for
them :)
See:https://blog.mozilla.org/security/2018/04/24/same-site-cookies-in-firefox-60
2020-04-04 15:49:40 +02:00
Jacques Le Roux 3a5a657604 Fixed: Ensure that the SameSite attribute is set to 'strict' for all cookies.
(OFBIZ-11470)

Forgot to add UtilHttp::SameSiteFilter
2020-03-21 11:31:56 +01:00
Dennis Balkir 54a429e8cc Implemented: _WARNING_MESSAGE_
(OFBIZ-10587)

Added warning message as a message type, by adding it in the
messages.ftl and the request-handler

Thanks to Niklas Fallik for reporting
2020-03-21 11:31:54 +01:00
Jacques Le Roux 0da38998a9 Improved: Remove unused ‘UtilHttp#checkURLforSpiders’
(OFBIZ-11138)

The "link.remove_lsessionid.user_agent_list" properties was forgotten
2020-03-21 11:31:47 +01:00
Jacques Le Roux c34491892a Improved:
Implemented:
Documented:
Completed:
Reverted:
Fixed:
Improved: no functional change
(OFBIZ-)
Explanation
Thanks:
2020-02-27 14:36:26 +01:00
Jacques Le Roux 969f48b7c9 Fixed: Add 'controlPath' attribute to 'ofbizUrl' freemarker macro
(OFBIZ-11317)

In some place, like at least themes/tomahawk/template/AppBarClose.ftl the CSRF
token is not generated. Because in those places OfbizUrlTransform is used.

An immediate solution is to add the CSRF token generation in OfbizUrlTransform
class.

A definitive solution is to complete OFBIZ-11229
"Merge UrlRegexpTransform and OfbizUrlTransform classes"
2020-02-15 13:24:09 +01:00
Nicolas Malin 11cf350302 Improved: Change 'restMethod' by '_method' in request parameters
(OFBIZ-11332)

When we analyse a request method, we currently check the parameter "restMethod".
Mathieu Lirzin propose [1] to use "_method" instead to use a parameter name more generic

I create a new function UtilHttp.getRequestMethod() to centralize the request method resolution.

[1] https://issues.apache.org/jira/browse/OFBIZ-11007?focusedCommentId=17012712&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-17012712
2020-01-29 10:50:29 +01:00
James Yong 05ffbd2817 Improved: Add 'controlPath' attribute to 'ofbizUrl' freemarker macro
(OFBIZ-11317)

Adding the controlPath attribute to allow the controls by ofbizUrl to support uri to other OFBiz web application.

Thanks: Jacques for the review
2020-01-12 22:25:50 +08:00
Mathieu Lirzin 20e0bbe55c Improved: Use ‘forEach’ in ‘RequestHandler’ for conciseness
No functional changes.
2020-01-03 14:32:31 +01:00
Mathieu Lirzin 7508917a0a Improved: Remove ‘RequestHandler#ControllerConfig’ wrapper
(OFBIZ-11313)

‘RequestHandler#ControllerConfig’ was a wrapper around
‘ConfigXMLReader#ControllerConfig’ used as a convenience to gather
error handling when accessing configuration properties. Since the
later is now only throwing exceptions when instantiating the object,
‘RequestHandler#ControllerConfig’ is not useful anymore.
2019-12-30 09:54:24 +01:00
Mathieu Lirzin 6c745f6ea5 Improved: Retrieve the included controller files eagerly
(OFBIZ-11313)

The included controller files resolution was previously delayed when
accessing the configuration properties. The issue is that it imposes
callers to handle exceptions when accessing those
properties. Additionally this has the drawback of detecting inclusion
issues late.

We are now retrieving the included files when instantiating the
controller configuration object. This provides more guarantee on the
integrity of instantiated controllers and relax the error handling
requirements on configuration properties callers.
2019-12-30 09:47:55 +01:00
Mathieu Lirzin aae1c8a8f5 Reverted: "Improved: Use ‘depends-on’ attribute instead of “component-load.xml”"
(OFBIZ-11296)

This reverts commit eeabe69813.
2019-12-18 12:09:20 +01:00
Mathieu Lirzin df5dde37d5 Improved: Replace getLocation with location in ‘ComponentConfig.WebappInfo’
(OFBIZ-11192)

Use Path instead of String + File.
2019-12-08 00:12:52 +01:00
Samuel Trégouët 98bfafd148 Improved: Resolve classpath conflict on freemarkerTransforms.properties
(OFBIZ-11161)

All files in {compoment}/config directories are placed in jar
root (cf. sourceSets definition in build.gradle) but there are 4 different
`freemarkerTransforms.properties` in ofbiz (content, product, webapp, widget).
This works fine because we are adding config directories in classpath (through
classpath tag in ofbiz-component.xml), but this is not really intuitive. So to
make things clearer this patch move `freemarkerTransforms.properties` into
`src/main/resources` with a namespace package and `FreeMarkerWorker.java` is
modified accordingly.
2019-12-07 23:13:10 +01:00
Samuel Trégouët e7bec48f16 Fixed: Use ‘WebAppUtil#parseWebXmlFile’ when handling “web.xml” files
(OFBIZ-6993)
2019-12-07 22:51:09 +01:00
Mathieu Lirzin 3c9af84245 Fixed: Display file name in XML parsing errors
(OFBIZ-6993)
2019-12-07 22:51:05 +01:00
Mathieu Lirzin eeabe69813 Improved: Use ‘depends-on’ attribute instead of “component-load.xml” (OFBIZ-11296)
We currently have two ways to define component loading order. Either
by using ‘depends-on’ attribute in “component-config.xml” or by adding
a “component-load.xml” file at the root of a component directory.

“depends-on” is more flexible because it handles partial ordering when
“component-load.xml” defines a total order which is not necessarily
meaningful, so it is better to rely only “depends-on”.

This removes the usage of “component-load.xml” to use ‘depends-on’
instead. The dependency declarations correspond to the total ordering
previously defined but will need to be refined in the future to relax
unnecessary dependency declarations.

Only “framework/base/config/component-load.xml” which defines the
top-level directories order (framework, applications, themes and
plugins) is kept.
2019-11-25 15:28:54 +01:00
Samuel Trégouët 889769593e Improved: Remove ‘ServiceEventHandler#checkSecureParameter’
(OFBIZ-11260)

There is no security reason justifying to prevent the invocation of
service event handlers with URI parameters if we accept request body
parameters.  As a consequence it is preferable to unconditionally
accept URI parameters and remove the
‘service.http.parameters.require.encrypted’ configuration property.
2019-11-04 22:52:16 +01:00
Samuel Trégouët f93b9ea29a Improved: Lint ‘ServiceEventHandler’ class
(OFBIZ-11260)
2019-11-04 22:50:14 +01:00
Jacques Le Roux 2af71198d4 Fixed: content/control/WebSiteCms?webSiteId=CmsSite fails
(OFBIZ-11266)

I did not notice that I unintentionally removed a line
while fixing OFBIZ-11259
2019-11-04 15:24:23 +01:00
Jacques Le Roux 34d30421dc Fixed: SOAPService does not work
(OFBIZ-11259)

This was broken by r1839451 committed at the bottom of OFBIZ-10438
A simple fix is to allow "webtools/control/SOAPService/serviceName?WSDL" scheme. 


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1869155 13f79535-47bb-0310-9956-ffa450edef68
2019-10-30 09:41:14 +00:00
Mathieu Lirzin bc2747dd67 Fixed: Fix javadoc build
(OFBIZ-11007)

This fixes the javadoc errors introduced in revision 1868963.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1869039 13f79535-47bb-0310-9956-ffa450edef68
2019-10-27 15:29:10 +00:00
Mathieu Lirzin 59efa181d2 Improved: Lint unit tests
This makes no behavioral changes, only coding style fixes.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1869037 13f79535-47bb-0310-9956-ffa450edef68
2019-10-27 12:51:08 +00:00
Mathieu Lirzin b1aaad3af6 Implemented: Handle URI templates in request maps
(OFBIZ-11007)

It is now possible to use segmented paths by using URI templates like
‘/foo/bar/{baz}’ in the ‘uri’ attribute of <request-map> elements.

Thanks: Artemiy Rozovyk for your contribution.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1868963 13f79535-47bb-0310-9956-ffa450edef68
2019-10-25 21:49:35 +00:00
Mathieu Lirzin b9d9f6144c Improved: Lint ‘ControlServlet’ partially
(OFBIZ-11007)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1868962 13f79535-47bb-0310-9956-ffa450edef68
2019-10-25 21:43:02 +00:00
Mathieu Lirzin 4cc9ba8968 Fixed: Format ‘XmlRpcEventHandler’
(OFBIZ-10284)

This removes coding style errors introduced in revision 1868611.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1868621 13f79535-47bb-0310-9956-ffa450edef68
2019-10-19 13:20:01 +00:00
Jacques Le Roux 1ef831206d Improved: Handling tenant in XmlRpcEventHandler
(OFBIZ-10284)

The XMLRPC service does not support tenants. Even if the tenant domain is 
included in the HTTP request the call does not affect the correct tenant. 
The issue and fix has been discussed in  in the thread
https://markmail.org/message/bz4dofrxqp6i7ove

jleroux: I was able to port the R16 patch provided by Rajesh to the trunk. 

Thanks: Rajesh Kumar Mallah

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1868611 13f79535-47bb-0310-9956-ffa450edef68
2019-10-19 06:42:07 +00:00
Jacques Le Roux 0bd6bf919b Fixed: NotSerializableException after uploading images to an order
(OFBIZ-11123)

I found that using in r1866259 the same fix than Si Chen used in OFBIZ-750 was 
wrong. The code just above this fix is

{code:java}
if (obj instanceof Serializable) {
    reqAttrMap.put(name, obj);
}
{code}

The problem with this code is that if does not handle inner Maps which may 
contain a non Serializable Object. So the solution is rather to get one level
deeper and apply the same. We can then remove the harcoded lines with 
"uploadedFile" and "_REQUEST_HANDLER_" below. Then all possible cases are handled
as long as we have not inner-inner-Maps




git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1868298 13f79535-47bb-0310-9956-ffa450edef68
2019-10-11 16:45:16 +00:00
Jacques Le Roux abb30935e8 Improved: Unknown request [d.png]; this request does not exist or cannot be
called directly.
(OFBIZ-11199)

I suppose this issue is similar to OFBIZ-11152. So I'm handling it the same.
It's not an end to the underneath issue but at least it can reassure user about 
things being handled...

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1866855 13f79535-47bb-0310-9956-ffa450edef68
2019-09-12 15:36:38 +00:00
Jacques Le Roux 7d7a441715 Fixed: Any ecommerce user has the ability to reset anothers password
(including admin) via "Forget Your Password"
(OFBIZ-4361)

Currently, any user (via ecommerce "Forget Your Password") has the ability to 
reset another users password, including "admin" without permission.  
By simply entering "admin" and clicking "Email Password", the following is 
displayed:

The following occurred:
A new password has been created and sent to you. Please check your Email.

This now forces the user of the ERP to change their password.  
It is also possible to generate a dictionary attack against ofbiz because there 
is no capta code required.  This is serious security risk.

I have modified the patch following comments I made in the Jira, notably
  Removed unused Java variables
  Removed a check in LoginEvents::forgotPassword which prevented to show error
    messages
  Changed fr and en SecurityExtPasswordSentToYou 
    + SecurityExtThisEmailIsInResponseToYourRequestToHave labels 
    + template PasswordEmail.ftl
    + loginservices.token_incorrect labels
  Added fr and en SecurityExtIgnoreEmail + SecurityExtLinkOnce labels
  Removed changes in general.properties
  I did not remove the 2 GetSecurityQuestion.ftl files (webpos one was still in)

There is still room for improvement. I'll discuss them on the Jira and dev
ML. But this version is already strong enough to not wait that the patch is 
inapplicable!

Thanks: mz4wheeler (Mike Z) for the Jira, Nicolas Malin for the patch, I guess 
with some Gil's help, and all others for comments and ideas

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1866478 13f79535-47bb-0310-9956-ffa450edef68
2019-09-05 15:56:46 +00:00
Jacques Le Roux 899bc6f27d Fixed: NotSerializableException after uploading images to an order
(OFBIZ-11123)

In a lot of services we use the ByteBuffer object to upload files. 
When a such service is used with the redirect-parameter in a controller the 
ByteBuffer needs to be serialized. Unfortunately ByteBuffer (in our case its
subclass HeapByteBuffer) is not serializable. So that can't work.

Fortunately no redirect-parameter concerns uploadedFile so we can safely remove
it from reqAttrMap in RequestHandler

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1866259 13f79535-47bb-0310-9956-ffa450edef68
2019-09-02 07:32:48 +00:00
Jacques Le Roux 24ae8bed84 Improved: Unknown request [images]; this request does not exist or cannot be
called directly.
(OFBIZ-11152)

Gives an advice to reassure users about the seriousness of the issue

This issue can be easily reproduced by going to example/control/FormWidgetExamples
Other backend components are less concerned but it happens sometimes in them too.
It's quite hard to understand what's happening.
This is a sequel of OFBIZ-10895

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1866255 13f79535-47bb-0310-9956-ffa450edef68
2019-09-02 07:05:08 +00:00
Jacques Le Roux ed3e9c661b Improved: Give nested requests related with checkLogin a propper Error-Message
in log
(OFBIZ-11154)

An error appears in log due to the nested request that can not be resolved 
properly.  

We should not worry about nested requests, they continue to work, and we should 
simply not show an error message from RequestHandler in case of nested request.

Thanks: Initialy spotted by Benjamin Jugl in OFBIZ-9379

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1865902 13f79535-47bb-0310-9956-ffa450edef68
2019-08-26 05:58:44 +00:00
Mathieu Lirzin b50bc07bb9 Improved: Add missing override annotation
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1865846 13f79535-47bb-0310-9956-ffa450edef68
2019-08-24 12:59:03 +00:00
Mathieu Lirzin cf79277608 Improved: Remove redundant "dtd" directory from classpath
(OFBIZ-11161)

the "dtd" directories are already present as resources distributed
inside OFBiz jar, so there is no need to augment the classpath to find
the XML schema inside those directories.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1865796 13f79535-47bb-0310-9956-ffa450edef68
2019-08-24 00:29:41 +00:00