Commit Graph
2159 Commits
Author SHA1 Message Date
Jacques Le Roux b8f9c029ce Fixed: Plugin not showing in menu due to permission (OFBIZ-12233)
When creating a plugin via gradle :
./gradlew createPlugin -PpluginId=plugin-test -PpluginResourceName=PluginTest
-PwebappName=plugin-test -PbasePermission=PLUGIN_TEST

and loading all the required data and permissions, the plugin doesn't appear
in the menu.

It comes from the ComponentConfig.java file, L1229, when the permissions gets
trimmed and modified. I tried removing it locally and it fixed the problem.

Thanks: Gaetan Chaboussie
2021-05-17 12:00:37 +02:00
Jacques Le Roux 2c6f3068de Improved: Improve ObjectInputStream denyList (OFBIZ-12221)
In SafeObjectInputStream.properties
  Renames listOfSafeObjectsForInputStream to allowList and fixes it
  Introduces a denyList

Adapts SafeObjectInputStream class to new denyList

Conflicts handled by hand
  framework/base/config/SafeObjectInputStream.properties
  framework/base/src/main/java/org/apache/ofbiz/base/util/SafeObjectInputStream.java
2021-04-07 09:18:24 +02:00
Jacques Le Roux 544d207cbd Improved: Improve ObjectInputStream denyList (OFBIZ-12221)
Prevents generics markup in string type names.

Conflict handled by hand
  framework/base/src/main/java/org/apache/ofbiz/base/util/SafeObjectInputStream.java
2021-04-05 17:04:59 +02:00
Jacques Le Roux 0f82c2679f Improved: Improve UtilObject class (OFBIZ-12216)
This removes the inoffensive but annoying message in log (which does not show in
trunk, see https://github.com/apache/ofbiz-framework/commit/27c9180/

Not the same as in trunk, simply handling with exception Rather than returning
null, also shorten java.rmi.server to java.rmi to block more cases
2021-03-30 12:38:19 +02:00
Jacques Le Roux e2c8ca6c48 Improved: Update Freemaker to 2.3.31 in R17 and R18 (OFBIZ-12196)
That's for (low) security reason. There are no bugs in R17 and R18 but after
reading about FREEMARKER-124 at
https://freemarker.apache.org/docs/versions_2_3_30.html
I believe we should update update Freemaker to 2.3.31 in R17 and R18
2021-03-22 11:06:32 +01:00
Jacques Le Roux 49faf1e8f7 Improved: Add a framework method to get main webapp menu with the webapp name (OFBIZ-10601)
app-shortcut-screen="component://product/widget/catalog/CatalogScreens.xml#ShortcutApp"
was present in applications/product/ofbiz-component.xml
but not in ofbiz-component.xsd
2021-03-22 11:05:01 +01:00
Michael Brohl 80a01d4fbd Fixed: Corrects wrong API use for Collections and Arrays
edu.emory.mathcs.backport.java.util.* instead of java.util.*
which was spotted during the jCenter to mavenCentral migration.
2021-02-27 14:43:38 +01:00
Jacques Le Roux 16fb51c370 Fixed: Bypass Java GString to String conversion in ObjectType::simpleTypeOrObjectConvert (OFBIZ-12182)
Follows https://markmail.org/message/azn7e4g2rbpo7tvj

Conflicts handled by hand
 framework/base/src/main/java/org/apache/ofbiz/base/util/ObjectType.java
2021-02-19 09:38:09 +01:00
Michael Brohl 177b96300f Improved: Replaces ModelInduceFromDb with widgets (OFBIZ-6510)
This is a manual backport of the related two commits in trunk with minor
changes to fit the r18.12 codebase.
2021-02-11 21:12:26 +01:00
Jacques Le Roux ee51eb7360 Fixed: Adds a blacklist (to be renamed soon to denylist) in Java serialisation (OFBIZ-12167)
Adds an example based on RMI which is known to be a problem
2021-02-05 11:03:26 +01:00
Jacques Le Roux 42571fb635 Fixed: Post-auth XSS vulnerability at catalog/control/EditProductPromo (OFBIZ-12096)
Prevents issues with integration tests

Conflicts handled by hand:
framework/base/src/main/java/org/apache/ofbiz/base/util/UtilCodec.java
2020-12-19 20:44:45 +01:00
Jacques Le Roux d620550a5f Fixed: Post-auth XSS vulnerability at catalog/control/EditProductPromo (OFBIZ-12096)
We missed to unescape EcmaScript encoded strings in
UtilCoded::checkStringForHtmlSafe, ie in all form fields using allow-html="safe"

Thanks: 牛治 <niu.zhi@zte.com.cn> for report

Conflicts handled by hand => no functional changes in code (ude to IDE setting)
framework/base/src/main/java/org/apache/ofbiz/base/util/UtilCodec.java
2020-12-19 18:20:14 +01:00
Jacques Le Roux 8b511e3c0b Fixed: Secure the uploads (OFBIZ-12080)
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.

# Conflicts handled by hand:
#	applications/content/src/main/java/org/apache/ofbiz/content/data/DataResourceWorker.java
#	applications/content/src/main/java/org/apache/ofbiz/content/data/DataServices.java
#	applications/product/groovyScripts/catalog/category/EditCategory.groovy
#	applications/product/groovyScripts/catalog/config/EditProductConfigItemContent.groovy
#	applications/product/groovyScripts/catalog/imagemanagement/ImageUpload.groovy
#	applications/product/groovyScripts/catalog/imagemanagement/SetDefaultImage.groovy
#	applications/product/groovyScripts/catalog/product/EditProductContent.groovy
#	applications/product/src/main/java/org/apache/ofbiz/product/image/ScaleImage.java
#	applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/FrameImage.java
#	applications/product/src/main/java/org/apache/ofbiz/product/imagemanagement/ImageManagementServices.java
#	applications/product/src/main/java/org/apache/ofbiz/product/product/ProductServices.java
#	build.gradle
#	framework/base/src/main/java/org/apache/ofbiz/base/util/FileUtil.java
#	framework/base/src/main/java/org/apache/ofbiz/base/util/HttpRequestFileUpload.java
#	framework/base/src/main/java/org/apache/ofbiz/base/util/template/FreeMarkerWorker.java
#	framework/security/config/security.properties
2020-12-01 10:27:22 +01:00
Jacques Le Roux 01c0ff5469 Fixed: Prevent Zip Slip vulnerability (OFBIZ-12056)
While working with FileUtil::unzipFileToFolder I noticed that it's vulnerable to
Zip slip vulnerability: https://snyk.io/research/zip-slip-vulnerability.

Fortunately OOTB code does not use FileUtil::unzipFileToFolder so I did not
create a CVE, nor reported to
https://github.com/snyk/zip-slip-vulnerability#user-content-projects-affected-and-fixed.
If you think we should please shime in...
2020-11-14 11:43:38 +01:00
Jacques Le Roux b420b0ea5d Fixed: NotSerializableException using uploadPartyContentFile service (OFBIZ-12050)
Removes a warning:

UtilMisc.java:202: warning: [rawtypes] found raw type: Iterator
Iterator itr = arrayList.iterator();
^
missing type arguments for generic class Iterator<E>
where E is a type-variable:
E extends Object declared in interface Iterator
2020-11-06 11:30:53 +01:00
Jacques Le Roux af464dfa70 Fixed: NotSerializableException using uploadPartyContentFile service (OFBIZ-12050)
This error appears after trying to upload a file to party content:

2020-11-06 07:48:22,488 |jsse-nio-8443-exec-7 |RequestHandler                |I|
Sending redirect to:
[https://localhost:8443/partymgr/control/viewprofile?partyId=admin].
2020-11-06 07:48:29,288 |jsse-nio-8443-exec-7 |UtilObject                    |E|
null
java.io.NotSerializableException: org.apache.commons.fileupload.disk.DiskFileItem

# Conflicts handled by hand
#	framework/base/src/main/java/org/apache/ofbiz/base/util/UtilMisc.java
#	framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/RequestHandler.java
2020-11-06 11:07:19 +01:00
Jacques Le Roux 9cfd5a73e1 Fixed: Sorting of lists generates undesired results (OFBIZ-8302)
For this issue (OFBIZ-8302) I reverted the point 1 of
http://svn.apache.org/viewvc?view=revision&revision=1759555

As reported by Alvaro Munoz from GH security team it's not sufficient:
<<the second part of the fix was not effective, since the attacker can close the
raw string context with a double quote and write a new attribute or even close
the macro tag and write arbitrary FreeMarker code.>>

So this removes the 2nd part and add better solution to fix the OFBIZ-8302 issue
The solution is to encode only the QueryString and to handle it correctly in
UtilHttp::getParameterMap. I must say it was not a sinecure!

# Conflicts:
#	framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHttp.java
#	framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java
2020-10-31 19:14:21 +01:00
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 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 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
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 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
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 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 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 a0495b344e Fixed: Improve ObjectInputStream class (CVE-2019-0189)
Improved: no functional change
(OFBIZ-10837) (OFBIZ-11398)

I missed to update refactored UtilObject class
2020-02-24 12:50:15 +01:00
Jacques Le Roux e78cc49d71 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

Thanks: Dikpal Kanungo for reporting

# Conflicts:
# SafeObjectInputStream.java
Handled by hand
2020-02-24 11:37:07 +01:00
Michael Brohl f1fba85637 Provide a FileItem entry in UtilHttp.getMultiPartParameterMap.
(OFBIZ-11346)
2020-02-22 11:57:25 +01:00
Jacques Le Roux d916b92ec3 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:23:39 +01:00
Michael Brohl de75e163fb Revert "Multi Part Input Parameters not Available in Groovy Event (OFBIZ-5048)"
This reverts commit 02d59bcd5b.
2020-02-11 21:50:49 +01:00
Michael Brohl 91d136bb3e 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:36:42 +01:00
Michael Brohl 02d59bcd5b 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:52:51 +01:00
Jacques Le Roux 7ab1a82f54 Improved: Equivalent of svn:auto-props properties on the server
(OFBIZ-OFBIZ-11279)

This is needed as explained at https://s.apache.org/i86ht
2019-12-19 13:37:28 +01:00
Nicolas Malin 5b4010f716 Fixed: Possible NPE in StringUtil#strToMap
(OFBIZ-11281)

StringUtil#strToMap(String, String, boolean, String) throws Nullpointer for StringUtil.strToMap("", false).

Thanks to Ulrich Heidfeld for this fix
2019-11-14 09:16:25 +01:00
Jacques Le Roux 1c27d21260 Fixed: Getting policy error while editing html text data using cms
(OFBIZ-11265)

Service parameter with allow-html="safe" does not check the OWASP sanitizer flag
ie. enabled or not and perform sanitization which causing policy error while
editing text data

getting following exception error:
"In field [textData] by our input policy, your input has not been accepted for
security reason. Please check and modify accordingly, thanks."

Thanks: Pradeep Choudhary for report and suggestion
(cherry picked from commit 8aea160e04)
2019-11-07 15:48:15 +01:00
Mathieu Lirzin a974256781 Fixed: Handle whitelist of serializable classes from properties
(OFBIZ-11261)

There was a bug regarding the way the ‘ListOfSafeObjectsForInputStream’ value
defined in the “SafeObjectInputStream.properties” file was handled.  Mistakenly
only one class identifier was allowed.

The tests have not been backported from ‘trunk’ because of the way
‘UtilProperties#setPropertyValueInMemory’ work in 18.12.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/branches/release18.12@1869003 13f79535-47bb-0310-9956-ffa450edef68
2019-10-26 14:54:20 +00:00
Mathieu Lirzin 5476629453 Fixed: Use ‘ConcurrentHashMap’ to avoid ‘ConcurrentModificationException’
(OFBIZ-11258)

When trying to load components in their dependency order the
‘toBeLoadedComponents’ map is modified while being iterated over which
is not safe for non-concurrent maps.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/branches/release18.12@1868666 13f79535-47bb-0310-9956-ffa450edef68
2019-10-20 16:51:09 +00:00
Mathieu Lirzin f26ae54727 Fixed: Adapt some javadoc to let the build succeed
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/branches/release18.12@1868623 13f79535-47bb-0310-9956-ffa450edef68
2019-10-19 13:37:37 +00:00
Jacques Le Roux 1494beb6f0 "Applied fix from trunk for revision: 1866834"
------------------------------------------------------------------------
r1866834 | jleroux | 2019-09-12 09:49:41 +0200 (jeu. 12 sept. 2019) | 8 lignes

Improved: Improve ObjectInputStream class
(OFBIZ-10837)

Fixes CVE-2019-0189

Allows users to easily override the list of accepted objects by using the
listOfSafeObjectsForInputStream property

CVE-2019-0189

------------------------------------------------------------------------


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/branches/release18.12@1866835 13f79535-47bb-0310-9956-ffa450edef68
2019-09-12 07:50:54 +00:00
Jacques Le Roux cedd7a3441 "Applied fix from trunk for revision: 1865347"
------------------------------------------------------------------------
r1865347 | jleroux | 2019-08-17 13:34:01 +0200 (sam. 17 août 2019) | 9 lignes

Fixed: Issue loading solr component (JNDI timeout)
(OFBIZ-11156)

We need to provide a JNDI environment property for Solr to load faster

Fixes previous commit where I hastily harcoded in jndi.properties file

Used a system property which can be used to define a JNDI environment 
property
------------------------------------------------------------------------


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/branches/release18.12@1865348 13f79535-47bb-0310-9956-ffa450edef68
2019-08-17 11:34:59 +00:00
Jacques Le Roux 7172a46bb9 "Applied fix from trunk for revision: 1865344"
------------------------------------------------------------------------
r1865344 | jleroux | 2019-08-17 13:07:01 +0200 (sam. 17 août 2019) | 4 lignes

Fixed: Issue loading solr component (JNDI timeout)
(OFBIZ-11156)

We need to provide a JNDI environment Property for Solr to load faster
------------------------------------------------------------------------


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/branches/release18.12@1865345 13f79535-47bb-0310-9956-ffa450edef68
2019-08-17 11:07:37 +00:00
Jacques Le Roux ff12b7afd3 "Applied fix from trunk for revision: 1864930"
------------------------------------------------------------------------
r1864930 | jleroux | 2019-08-11 15:23:19 +0200 (dim. 11 août 2019) | 4 lignes

Fixed: [FB] Find Security Bugs
(OFBIZ-9973)

As suggested by Mathieu on dev ML factorises the use of Path::normalize
------------------------------------------------------------------------


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/branches/release18.12@1864931 13f79535-47bb-0310-9956-ffa450edef68
2019-08-11 13:28:18 +00:00
Jacques Le Roux d06ad50f70 "Applied fix from trunk for revision: 1859972"
------------------------------------------------------------------------
r1859972 | jleroux | 2019-05-25 16:08:48 +0200 (sam. 25 mai 2019) | 12 lignes

Fixed: Duplicate entries in paramWithSuffix
(OFBIZ-11056)

when using string-list-suffix attribute for service definition, invoke method 
(from associated event handler) will try to parse parameters from both request 
variable and rawParameterMap which was also built from request. 
So we end up with duplicates in resulting list.

This behaviour seems to be introduced with OFBIZ-5048.


Thanks: Samuel Trégouët for report and fix 
------------------------------------------------------------------------


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/branches/release18.12@1859973 13f79535-47bb-0310-9956-ffa450edef68
2019-05-25 14:10:46 +00:00