Commit Graph
9534 Commits
Author SHA1 Message Date
Jacques Le Roux d708d9afcb 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:59:39 +02:00
Pawan Verma d913366851 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:24:23 +05:30
Jacques Le Roux c7a5b22e0e Improved: Prevent FreeMarker Template Injection (SSTI)
(OFBIZ-11709)

This commit does 2 things:

Send a correct commit comment (kind of amendment, w/o push force)
Previous code compiled but SAFER_RESOLVER is not a class but a field, better KISS

Real change:
Better style with line not too long:
2020-05-18 22:50:28 +02:00
Jacques Le Roux 78cb314066 Improved:
Implemented:
Documented:
Completed:
Reverted:
Fixed:

(OFBIZ-)
Explanation
Thanks:
2020-05-18 15:26:15 +02:00
Jacques Le Roux c502a978a0 Improved: Prevent FreeMarker Template Injection (SSTI)
(OFBIZ-11709)

Fixes all the conflicts previously handled by hand (no merge was possible)
2020-05-18 13:48:31 +02:00
Jacques Le Roux babd23282e 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 all handled by hand (no merge possible)
2020-05-18 13:35:02 +02:00
Jacques Le Roux dc60f6fdb3 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
2020-05-16 20:56:54 +02:00
Pawan Verma 6b04468f45 Fixed: Theme files loading taking longer time
(OFBIZ-11665)

Thanks: Pierre and Jacques for the review.
2020-05-10 14:19:03 +05:30
Pawan Verma 4cd701023c 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:58:58 +05:30
Jacques Le Roux 27c91802fc 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:42:45 +02:00
Jacques Le Roux 45535e34cb 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

Conflicts handled by hand
 applications/party/template/party/profileblocks/Content.ftl
 framework/common/groovyScripts/CommonServices.groovy
2020-05-02 12:42:12 +02:00
Pawan Verma 5eadb77a88 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:56 +05:30
Jacques Le Roux 0e20d16cfd 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:45:28 +02:00
Jacques Le Roux 6189bd8ddd 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.

jleroux: completely backported by hand

Thanks: Olivier
2020-04-27 15:08:40 +02:00
Jacques Le Roux 9f5ebc48fd Fixed: Error in uploading very large files, ie >2MB
(OFBIZ-11534)

This was not supposed to be committed, actually (wrong) part of OFBIZ-11597

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:16:14 +02:00
Jacques Le Roux 9530d4b441 Documented: Adds the CSRF defense documentation (missed the add last time) 2020-04-15 19:44:03 +02:00
Jacques Le Roux 242e62d6f3 Documented: Adds the CSRF defense documentation 2020-04-15 19:44:01 +02:00
Jacques Le Roux 42ad34f0b6 Fixed: removes a wrong import due to CSRF token backport trying 2020-04-05 12:02:06 +02:00
Jacques Le Roux 793628bb15 Fixed: Prevent Host Header Injection (CVE-2019-12425)
(OFBIZ-11583)

Conflicts handled by hand
  framework/security/config/security.properties
  framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/RequestHandler.java
2020-04-05 11:40:48 +02:00
Jacques Le Roux 84e102a6a1 Revert "Merge branch 'JacquesLeRoux-POC-for-CSRF-Token-OFBIZ-11306' into trunk"
This reverts commit 27e57522b1.
2020-04-05 10:05:16 +02:00
Jacques Le Roux 27e57522b1 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

Much Conflicts, but that should be OK
2020-04-04 18:41:14 +02:00
Jacques Le Roux cf936d6c5e 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:09:36 +01:00
Jacques Le Roux 7e03082d92 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:53 +01:00
Jacques Le Roux 1617226897 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

Conflicts handled by hand
	framework/security/config/security.properties
2020-03-21 11:59:46 +01:00
Jacques Le Roux 09270a1c34 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:39 +01:00
Jacques Le Roux 82ef7a5871 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:52:21 +01:00
Jacques Le Roux 87c0907f88 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.

jleroux: backport conflict handled by hand

Thanks: Benjamin Jugl
2020-02-26 08:50:56 +01:00
Michael Brohl 651231d041 Fixed: Fluent API Bug in getFieldList().
(OFBIZ-10298)

Thanks Benjamin Jugl for reporting and providing the patch.
2020-02-25 21:15:44 +01:00
Michael Brohl aeff5b75ec Documented: Upgrades the documentation references in
catalina/ofbiz-component.xml to the 9.0 documentation.
2020-02-25 15:50:49 +01:00
Michael Brohl 0ea9173e8d 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:50:47 +01:00
Jacques Le Roux 356be25ad2 Fixed: Improve ObjectInputStream class (CVE-2019-0189)
Improved: no functional change
(OFBIZ-10837) (OFBIZ-11398)

I missed to update the refactored UtilObject class
2020-02-24 12:55:28 +01:00
Jacques Le Roux d31e137293 Fixed: Improve ObjectInputStream class (CVE-2019-0189)
Improved: no functional change
(OFBIZ-10837) (OFBIZ-11398)

Steps to generate:
1. Navigate to - catalog/control/EditProdCatalog?prodCatalogId=TestCatalog
2. Click on - CREATE SEO CATEGORY/PRODUCTS
3. The broken page will be displayed

The issue is due to the use of a GString in
createMissingCategoryAndProductAltUrls().

This:
    result.successMessageList = [
        "Categories updated: ${categoriesUpdated}",
        "Products updated: ${productsUpdated}"

As it's common to use such expressions I have added the necessary
org.codehaus.groovy.runtime.GStringImpl groovy.lang.GString
to the white list of classes in listOfSafeObjectsForInputStream in
SafeObjectInputStream.properties

I finally have also decided to use this property as default and commented for
committers to be aware that it should be also put in DEFAULT_WHITELIST_PATTERN
in SafeObjectInputStream class. Because if, for a reason,
listOfSafeObjectsForInputStream is empty OFBiz will still be protected

Note: cherry picking did not work at all. The change was completely handled by
hand. Fortunately, it was just about copyin 2 files from trunk

Thanks: Dikpal Kanungo for reporting
2020-02-24 11:55:52 +01:00
Deepak Dixit 1a8903e1d5 Fix build failure for release17.12 2020-02-23 16:56:57 +05:30
Michael Brohl 0dd0264d7d Provide a FileItem entry in UtilHttp.getMultiPartParameterMap.
(OFBIZ-11346)
2020-02-22 12:01:04 +01:00
Jacques Le Roux 250991a517 Fixed: replaceFirst sensible to variable pattern
(OFBIZ-11396)

When using variable pattern with replaceFirst you may cross issues if the
pattern contains specific tokens. For instance on Windows with the path
"C:\projectsASF\Git\ofbiz-framework/" you have inside the token "\p" which has
a special meaning.
2020-02-22 09:43:44 +01:00
Deepak Dixit 5776818efb Added missing GeoAssoc data for Ladakh geo
(OFBIZ-11399)
2020-02-22 13:03:41 +05:30
Deepak Dixit c315244900 Update India Geo information according to ISO notifications 2019-11-22
(OFBIZ-11399)

Change of subdivision category from state to Union territory for IN-JK; Addition of Union territory IN-LA;
2020-02-22 12:56:11 +05:30
Suraj Khurana c175337b84 Fixed: UserLoginPasswordHistory is not maintaining password as present in UserLogin.
(OFBIZ-10802)
Thanks Rohit Koushal for the patch. Thanks Jacques Le Roux and Gil Portenseigne for the review.
2020-02-22 12:53:28 +05:30
Jacques Le Roux afae70b71a Fixed: replaceFirst sensible to variable pattern
(OFBIZ-11396)

When using variable pattern with replaceFirst you may cross issues if the
pattern contains specific tokens. For instance on Windows with the path
"C:\projectsASF\Git\ofbiz-framework/" you have inside the token "\p" which has
a special meaning.
2020-02-22 07:30:46 +01:00
Gil Portenseigne cf1612644e Revert "Fixed: Error in user impersonation with sub permission (OFBIZ-11342)"
This reverts commit 73b7abbd
2020-02-12 12:22:59 +01:00
Gil Portenseigne 73b7abbdd0 Fixed: Error in user impersonation with sub permission
(OFBIZ-11342)

Add unit tests for permission control feature.
Add new method to manage multilevel permission control.
This allowing an user with PARTYMGR_ADMIN permission to impersonate
another user with PARTYMGR_PCM_CREATE permission.
2020-02-12 09:55:00 +01:00
Michael Brohl ec3dd184d9 Revert "Multi Part Input Parameters not Available in Groovy Event (OFBIZ-5048)"
This reverts commit 832217135a.
2020-02-11 21:50:21 +01:00
Michael Brohl 732172787e Fixed: Form widget field with input-method="time-dropdown" unable to
understand the default time.
(OFBIZ-11150)

Thanks Wiebke Pätzold for reporting and providing the patch.
2020-02-07 16:45:57 +01:00
Nicolas Malin 7c8fc080f3 Fixed: Crashed Scheduled jobs are not getting rescheduled with temporal expression
(OFBIZ-11340)

When a OFBiz server are stopped or crashed with job on queued state,
at the start, they are restarted but without information on tempExprId and recurrenceInfoId

This causes a break for recurrence jobs to their planning

Thanks to Mohammed Rehan Khan for this issue and Scott Gray for the review.
2020-02-06 17:14:53 +01:00
Jacques Le Roux 6ce10278a3 Fixed: setUserTimeZone should ran only once based on error
(OFBIZ-11329)

This will be notably useful when committing CSRF solution as explained in
OFBIZ-11306:

SetTimeZoneFromBrowser when starting gives a  RequestHandlerException:
Invalid or missing CSRF token for AJAX call to path '/SetTimeZoneFromBrowser'.
Also not only when starting.

Thanks: James Yong for review
(cherry picked from commit 350c71f4df)

# Conflicts:
#	framework/common/groovyScripts/SetLocaleFromBrowser.groovy
#	themes/common-theme/webapp/common/js/util/setUserTimeZone.js replaced
by setUserLocale.js modified by hand

I can compile locally but I can see a reason why and certainly not related to
these changes
2020-02-05 11:28:45 +01:00
Jacques Le Roux b2e3cc717d Fixed: impersonateLogin
(OFBIZ-5409)

I reopended this old issue because, while working on  OFBIZ-11329, I found that
userLogin and impersonateLogin should be removed from
jsonResponseFromRequestAttributes

Thanks: James Yong for pointing that out

# Conflicts:
#	framework/common/src/main/java/org/apache/ofbiz/common/CommonEvents.java
2020-02-04 15:48:46 +01:00
Nicolas Malin 9b9db9e511 Improved: Improve error message page to support Theming
(OFBIZ-10753)

When OFBiz raise an error, the framework use a jsp page to display it.
I improved the error page generation to support also ftl template rendering and by this way extend the theme engine to support to overide it

On controler.xml we can now use :
    <errorpage>/error/error.jsp</errorpage>
or
    <errorpage>component://common/webcommon/error/Error.ftl</errorpage> (default configuration)

On your theme you can add your own error page :
    <template>
      ...
      <template-file widget=menu location=component://common-theme/template/macro/HtmlMenuMacroLibrary.ftl/>
    + <template-file widget=error location=component://common-theme/template/ErrorPage.ftl/>
    </template>

The component://common/webcommon/error/Error.ftl contains the logic theming connection and to simplify source code, all framework old error page (error.jsp) have been removed to centralize all on this new page.

Thanks to Marine Desmarchelier for the error page design

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1856175 13f79535-47bb-0310-9956-ffa450edef68

# Conflicts:
#	framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ControlServlet.java
#	themes/common/template/ErrorPage.ftl
2020-02-01 11:08:21 +01:00
Michael Brohl 832217135a Multi Part Input Parameters not Available in Groovy Event
(OFBIZ-5048)

This change provides easier access to the FileItem by not wrapping it
into a buffer.
2020-01-31 15:51:51 +01:00
Michael Brohl b0aff701d0 Improved: ‘EntityOperator#getId()’ is not used in the framework
(OFBIZ-10607)

Thanks Mathieu Lirzin for reporting and providing the patch.
2020-01-30 20:57:16 +01:00
Samuel Trégouët 6facc0e73d Fixed: Use ‘WebAppUtil#parseWebXmlFile’ when handling “web.xml” files
(OFBIZ-6993)

# Conflict handled by hand in:
#	framework/catalina/src/main/java/org/apache/ofbiz/catalina/container/CatalinaContainer.java
2019-12-19 08:47:13 +01:00