Commit Graph
9753 Commits
Author SHA1 Message Date
Jacques Le Roux 41bbf15933 Fixed: Error while decoding url parameters with percent character (OFBIZ-12014)
This has been already fixed (an clearly explained) in OFBIZ-10275 and broken
again in OFBIZ-11822

Thanks: Pradeep Choudhary
2020-09-14 11:18:57 +02:00
Jacques Le Roux b263ddc2d2 Revert "Improved: Improves service-eca.xsd documentation (OFBIZ-9994)"
This reverts commit 0231626f1c. These changes
should not have been backported
2020-08-31 09:13:33 +02:00
Jacques Le Roux 0231626f1c Improved: Improves service-eca.xsd documentation (OFBIZ-9994)
Fixes some issues

# Conflicts:
#	framework/service/dtd/service-eca.xsd
2020-08-30 18:59:27 +02:00
Jacques Le Roux 1866a3c464 Fixed: Server-Side Template Injection using Static (OFBIZ-11871)
Thanks to Alvaro's explanations, the problem was in MacroFormRenderer where, for
lookups, we retrieve _LAST_VIEW_NAME_ as a parameter without encoding it.

Thanks: Alvaro for advice

Conflicts handled by hand in UtilHttp.java
2020-08-03 11:02:32 +02:00
Jacques Le Roux 546de4eb1a Fixed: MODULE is not module :/ (backporting is never easy!) 2020-07-11 11:18:52 +02:00
Jacques Le Roux ecc4e84a95 Fixed: don't remove localhost from host-headers-allowed this was only for testing 2020-07-11 09:57:04 +02:00
Jacques Le Roux c70fa51ae7 Improved: better message for host-headers-allowed
Adds an explanation about what to do when using own domain.

Some users don't look into the log so it's better to set also the exception
message in order for them to have it right at 1st glance.

Conflicts handled in webapp/control/RequestHandler.java
2020-07-11 09:47:23 +02:00
Michael Brohl b791dca9e7 Fixed: Added missing AJP connector property introduced for Tomcat 9.0.31
(OFBIZ-11848)
2020-07-03 17:35:17 +02:00
Pawan Verma 11dedfa79f Fixed: EntityQuery queryCount is throwing error with distinct method (OFBIZ-11294)
Added missing support for selectFields in queryCount and all the subsequent methods.

Thanks: Deepak Dixit for the review.
2020-06-28 01:41:57 +05:30
Jacques Le Roux b376a2f4b9 Fixed: getEntityRefData service has a weird issue (OFBIZ-11401)
MODULE does not exist in R18 (I did by hand in R17 so did not miss it...)
2020-06-18 18:26:39 +02:00
Jacques Le Roux 1e5ffa6e4c Fixed: getEntityRefData service has a weird issue (OFBIZ-11401)
It's reproductible on trunk demo though only visible in log, UI shows no issue

R17 and R18 are also affected, R16 is OK.

Ankush: This stacktrace should be coming for all entities where
default-resource-name is defined on entity definition but no property exist in
defined resource for key EntityDescription.entityname and FieldDescription.field.

As we want to have these entity labels as much as possible, we can simply print
warning about the missing entity descriptions and field descriptions for
readability purpose instead of printing huge exceptions stacktrace.

Thanks: Ankush Upadhyay and Pierre Smits for the help

Conflicts handled by hand (swallowing exceptions is lazy and bad :p)
2020-06-18 17:45:57 +02:00
Jacques Le Roux d2a976a592 Fixed: Double encoded urls are not being decoded (OFBIZ-11822)
This was broken by OFBIZ-10275

Thanks: Alex Bodnaru
2020-06-15 13:31:04 +02:00
Jacques Le Roux a4227abee0 Improved: no functional change
Adds missing ASL2 licenses

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1860259 13f79535-47bb-0310-9956-ffa450edef68
2020-06-09 11:48:38 +02:00
holivier 4568c6f55a Improvement: Help link using asciidoc files via generated html
(OFBIZ-11693)

Change release to 18.12 for all asciidoc files where there is still
17.12
2020-06-05 14:37:03 +02:00
Pawan Verma 1d3c7915c9 Fixed: startup-service does not work without runtime-data-id(OFBIZ-11668) 2020-06-02 17:25:51 +05:30
holivier 88f87f27f0 fixed: sort-order (field) not works in CompoundWidgets file (OFBIZ-11708)
In a form, when <sort-order tag is used, the children analyze not works
because, getTagName() is used not the getLocalName(). getTagName()
return "wf:sort-field" when getLocalName return "sort-field".
So change getTagName() to getLocalName() for sort-order children
2020-05-29 11:48:25 +02:00
holivier 6e845ccfc4 Fixed: drop-down field not work when in a compound-widget file (OFBIZ-11676)
When, in ModelFormField, FieldInfoWithOptions (which read xml file ) is
call, test on tag name is done with getName() and not getLocalName() so
none "option" is recognize when field is declare on a compound-widget
file. getName() is change to getLocalName()
2020-05-29 11:35:48 +02:00
Jacques Le Roux d955b03fdc Fixed: Apache OFBiz unsafe deserialization of XMLRPC arguments (CVE-2020-9496)
(OFBIZ-11716)

Because the 2 xmlrpc related requets in webtools (xmlrpc and ping) are not using
authentication they are vulnerable to unsafe deserialization.

thanks: Alvaro Munoz <pwntester@github.com> from the GitHub Security Lab team
2020-05-19 15:58:53 +02:00
Pawan Verma aea665a0e7 Fixed: Issue with redirect queryParameters when the user is logged out
(OFBIZ-11714)

In OFBIZ-10539, We missed removing the line which was adding parameters into the map as Ritesh suggested a good way to handle parameters. I've removed that redundant line of code and attaching a patch for the same.
2020-05-19 17:23:25 +05:30
Jacques Le Roux a67508c29c Improved: Prevent FreeMarker Template Injection (SSTI)
(OFBIZ-11709)

Better style with line not too long
2020-05-18 22:51:24 +02:00
Jacques Le Roux 191798f3af Improved: Prevent FreeMarker Template Injection (SSTI)
(OFBIZ-11709)

Fixes a typo: module instead of MODULE
2020-05-18 15:37:30 +02:00
Jacques Le Roux 07f48a3334 Improved: Prevent FreeMarker Template Injection (SSTI)
(OFBIZ-11709)

Previous code compiled but the class was not found, better KISS
2020-05-18 14:04:15 +02:00
Jacques Le Roux b97d6bf1e2 Improved: Prevent FreeMarker Template Injection (SSTI)
(OFBIZ-11709)

Some people may want to use another TemplateClassResolver than SAFER_RESOLVER
This creates a new templateClassResolver security property and uses it in
FreeMarkerWorker::makeConfiguration by default

Conflicts handled by hand
  framework/security/config/security.properties
2020-05-18 13:29:20 +02:00
Jacques Le Roux d2274170b4 Fixed: Prevent FreeMarker Template Injection (SSTI)
(OFBIZ-11709)

Since Freemarker 2.3.17 a known solution to these issues is to register a
TemplateClassResolver in Freemarker configuration in order to limit which
TemplateModels can be instantiated in the templates. The predefined resolver
SAFER_RESOLVER doesn't allow to instantiate the Execute class[4].

So the solution is to add the line
    newConfig.setNewBuiltinClassResolver(TemplateClassResolver.SAFER_RESOLVER);
in FreeMarkerWorker.java

Conflicts handled by hand
2020-05-16 20:52:51 +02:00
Pawan Verma e15c82b254 Fixed: Theme files loading taking longer time
(OFBIZ-11665)

Thanks: Pierre and Jacques for the review.
2020-05-10 14:18:11 +05:30
Pawan Verma caceb7c53b Fixed: Issue with opening a page via bookmark when the user is logged out
(OFBIZ-10539)

Thanks: Ritesh Kumar for report and the patch and Girish for the review.
2020-05-05 14:57:30 +05:30
Jacques Le Roux c7a81dbc6b 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:36:14 +02:00
Pawan Verma 8e2bb295cf 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:57:15 +05:30
Jacques Le Roux 54283206ad Fixed: Compound-widget not works with condition
(OFBIZ-11606)

Fixes a compilation issue due to backporting a line too much
2020-04-27 18:16:06 +02:00
Jacques Le Roux 1bdd636146 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:44:55 +02:00
Jacques Le Roux 0805e57f08 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:33:23 +02:00
Jacques Le Roux 711ca41715 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 16:08:17 +02:00
Jacques Le Roux 3e22e45c36 Documented: Adds the CSRF defense documentation (missed the add last time) 2020-04-15 19:42:39 +02:00
Jacques Le Roux 18b3fa80ad Documented: Adds the CSRF defense documentation 2020-04-15 19:37:48 +02:00
Jacques Le Roux f29c62e9b6 Improved: prevent [rawtypes] found raw type: List at RequestHandler.java:85 2020-04-05 12:16:02 +02:00
Jacques Le Roux 5530e23738 Fixed: Prevent Host Header Injection (CVE-2019-12425)
(OFBIZ-11583)
2020-04-05 11:35:33 +02:00
Jacques Le Roux 9fa3dbe1ea Revert "Merge branch 'JacquesLeRoux-POC-for-CSRF-Token-OFBIZ-11306' into trunk"
This reverts commit 0add8bedbc.
2020-04-05 10:04:15 +02:00
Jacques Le Roux 0add8bedbc Merge branch 'JacquesLeRoux-POC-for-CSRF-Token-OFBIZ-11306' into trunk
Because of GitHub message on PR56:
This branch cannot be rebased due to conflicts

Conflicts handled by hand
RequestHandler.java
2020-04-04 18:33:11 +02:00
Jacques Le Roux 8f51785dab 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-03-27 11:08:38 +01:00
Jacques Le Roux b466b96741 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-03-27 10:11:14 +01:00
Jacques Le Roux d08a0527c4 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-03-21 11:56:39 +01:00
Jacques Le Roux c3dd26c6ef Fixed: Ensure that the SameSite attribute is set to 'strict' for all cookies.
(OFBIZ-11470)

Forgot to add UtilHttp::SameSiteFilter
2020-03-20 18:05:07 +01:00
Jacques Le Roux 3d8c00fceb Fixed: Ensure that the SameSite attribute is set to 'strict' for all cookies.
(OFBIZ-11470)

As reported by OWASP ZAP:
A cookie has been set without the SameSite attribute, which means that the
cookie can be sent as a result of a 'cross-site' request. The SameSite attribute
is an effective counter measure to cross-site request forgery, cross-site script
inclusion, and timing attacks.

The solution was not obvious in OFBiz for 2 reasons:

1. There is no HttpServletResponse::setHeader. So we need to use a filter
  (SameSiteFilter) and even that is not enough because of 2:
2. To prevent session fixation we force Tomcat to generates a new jsessionId,
ultimately put in cookie, in LoginWorker::login. So we need to add a call to
SameSiteFilter::addSameSiteCookieAttribute in
UtilHttp::setResponseBrowserDefaultSecurityHeaders.
2020-03-20 17:51:45 +01:00
Jacques Le Roux 370159feeb Merge pull request #37 from danwatford/ofbiz-11418-backport18.12
OFBIZ-11418: Backport -  Use FlexibleStringExpander in form widget lookup field target parameters
2020-03-09 10:55:02 +01:00
Daniel Watford 308982526d Documented: Backport - Documented use of field attribute parameter-name and
lookup field attribute target-parameter in widget-form.xsd

(OFBIZ-11418)

Backport cherry-picked from commit
5640de4eba.
2020-03-02 09:35:31 +00:00
Daniel Watford b518a5df2e Improved: Backport - Use FlexibleStringExpander in form widget lookup
field target parameters.

(OFBIZ-11418)

Changed target-parameter attribute of the form widget's Lookup field to
use the FlexibleStringExpander type rather than String. This has been
done to allow reference to other form fields which may have had their
parameter-name attribute set to a FlexibleStringExpander expression.

Backport cherry-picked from commit
08a371d047 with ModelFormFieldTest
removed.
2020-03-02 09:29:51 +00:00
Jacques Le Roux d2128ffeaa Fixed: DatabaseUtil.getColumnInfo(...) does not retrieve primary keys due to
connection-locks
(OFBIZ-11312)

The method DatabaseUtil.getColumnInfo(...) uses an elaborate algorithm using a
List<Future<AbstractCountingCallable>> object. This does not work properly as it
runs into connection-locks. When debugging the error does not occur. I assume
that the slower pace of debugging prevents the error.

Thanks: Benjamin Jugl

# Conflicts:
#	framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/DatabaseUtil.java
2020-02-26 08:41:37 +01:00
Michael Brohl f4d96deeca Fixed: Fluent API Bug in getFieldList().
(OFBIZ-10298)

Thanks Benjamin Jugl for reporting and providing the patch.
2020-02-25 21:15:49 +01:00
Michael Brohl 57b6e539f7 Documented: Upgrades the documentation references in
catalina/ofbiz-component.xml to the 9.0 documentation.
2020-02-25 15:55:33 +01:00
Michael Brohl 018ebbb265 Upgrade Tomcat from 9.0.29 to 9.0.31
(OFBIZ-11407)

Overriding the new default property secretRequired to be not required
and added the default property "secret" in the commented out section.
2020-02-25 15:49:18 +01:00