Commit Graph
9803 Commits
Author SHA1 Message Date
Aditya Sharma 38b97e6ad3 Fixed: removed unused asmselect files and unused variable asm_asmListItemPercentOfForm (OFBIZ-10113)
asm select library is already replaced with select2 library, but the library files still exist in code base unused.
asm_asmListItemPercentOfForm varaible was used to set the width of the selected items which were displaced distictly from select fields. With select2, the selected items display inside the input field so it is no more needed

Thanks Jacques Le Roux for reporting it
2021-05-12 12:20:23 +05:30
Jacques Le Roux 9730842eac Fixed: Secure the uploads (OFBIZ-12080)
Reopened after report of a bug (only on *nix systems) by Shrilesh Korgaonkar.
This fixes the issue

Thanks: Shrilesh Korgaonkar
2021-04-16 09:24:27 +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 e5809580bb Documented: Comment out the SOAP and HTTP engines (OFBIZ-12212)
Documents that the EntitySync feature is no longer available OOTB.
You need first to re allow the HTTP engine
2021-03-30 13:05:25 +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 c2d56b70ff Improved: Comment out the SOAP and HTTP engines (OFBIZ-12212)
The SOAP and HTTP engines are open doors to security issues.
At https://markmail.org/message/pgtjyh23bazq4s2w I proposed to comment them out
as we did for RMI in the past.
Of cause it must be clearly documented how to use them if needed.

Here is the email content:

    After the recent fix for the CVE-2021-26295[1] we discussed with the security
    team about the opportunity need to comment out the SOAP and HTTP engines
    like we did in the past for RMI[2], this obviously for security reason.

    [1] OFBIZ-12167 "Adds a blacklist (to be
    renamed soon to denylist) in Java serialisation (CVE-2021-26295)"
    [2] OFBIZ-6942 "Comment out RMI related
    code because of the Java deserialization issue [CVE-2016-2170] "

I just put a small comment in webtools controller, it should be enough.

The tests pass
2021-03-29 13:19:26 +02:00
Jacques Le Roux 87c03d4e06 Fixed: addImageForProduct fails (OFBIZ-12211)
The addImageForProduct  process is not directly uploading a file but renames it
before.So there is a hyphen, and possibly a pair or parenthesis in case of
duplicate files, added to the file name.

In this commit I have also added the possibility to use underscores and spaces
in the original filename
2021-03-29 11:08:42 +02:00
Jacques Le Roux a324669af0 Fixed: Secure the uploads (OFBIZ-12080)
Fixes an issue reported by 赖涵 <1044309102@qq.com>: "Any file upload and delete
in latest Apache OFBiz"

It was a simple syntax error on my side
2021-03-26 19:14:29 +01:00
Jacques Le Roux 221ae70557 Improved: Secure the uploads (OFBIZ-12080)
Improves the error message for the file name part
2021-03-24 19:16:14 +01: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
Pawan Verma b2a59b12a9 Fixed: Error in deleting Financial Account (OFBIZ-12153)
1. Navigate to URL: accounting/control/FindFinAccount
2. Click on Find button. List of fin account will be displayed.
3. Click on delete button near available balance column.

Thanks: Lalit Dashora for report, Sourabh Jain for the initial fix, Jacques for the test.
2021-03-15 13:14:12 +05:30
SebastianEcomify fabbba342c Fixed: Addressed log issues caused in FindGeneric.groovy (OFBIZ-12193) (#285)
The backportet Version of searchForm in FindGeneric.groovy was to
advanced for the 18.12 Version. The form was changed back to its
previous version and the changes causing the view Error in ViewEntities
have been worked into it
2021-03-12 11:01:44 +01:00
Jacques Le Roux 82c2258247 Fixed: webtools/control/threadList no longer works on trunk (only) (OFBIZ-12195)
It works if we downgrade Freemarker to 2.3.28 as in R18 and even using 2.3.29,
not 2.3.30.

Handles things at the Groovy level, ie put in context, rather than creating
in Freemarker template.

It's backported, even if it's not a pb but in trunk, because it's a (low)
security issue.
2021-03-12 08:59:08 +01:00
Jacques Le Roux d61fb40e56 Fixed: Cant search ViewEntity InventoryItemDetailForSum (OFBIZ-12193)
Go to Entity Engine - >
search entity InventoryItemDetailForSum (view entity) ->
search for entries -> an error message is shown.

A SQL exception occurred running the service executeFind

Thanks: Sebastian Berg

Conflicts handled by hand
 framework/webtools/groovyScripts/entity/FindGeneric.groovy
2021-03-08 10:09:45 +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 3566bd3ff8 Fixed: fixes wrong wiki URLs 2021-02-22 11:26:21 +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
Deepak Dixit 4d689bdfb4 Fixed: Corrected property name as defined in general.properties
(OFBIZ-10008)
2021-02-17 12:49:30 +05:30
Jacques Le Roux be94f44da3 Fixed: webapp position does not really work (OFBIZ-12176)
Remove webtools from secondary menu to get it in right (12) position
2021-02-15 13:57:52 +01:00
Jacques Le Roux f0b9741347 Improved: Default ordering of webapps titles in main menu (OFBIZ-12166)
[...] having more important apps in 1st places would be better [...]
the feature should be easily changed by custom projects [...]
documentation for that would be enough.

This 1st step sorts the applications and webtools. I believe webtools should not
be secondary but that needs to be discussed with other options.

Conflicts handled by hand applications/product/ofbiz-component.xml
2021-02-15 12:26:14 +01:00
Jacques Le Roux 1ed018c677 Fixed: Remove _PREVIOUS_REQUEST_ Session Attribute on non-authentication pages (OFBIZ-12047)
After some small study, it seem there is a problem because login request not
require authentication

I have tried to add a test to check if current request is login and only if it's
not to remove PREVIOUS_REQUEST Session Attribute, it seem better with this
modification.

Thanks: Olivier for the patch and Michael for suggesting to parameterize using
a property. I simply used EntityUtilProperties.getPropertyValue instead of
UtilProperties.getPropertyValue

Conflicts: handled by hand
 framework/security/config/security.properties
2021-02-13 12:31:52 +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
Ingo Könemann 03167586f9 Fixed: Remove _PREVIOUS_REQUEST_ Session Attribute on non-authentication
pages (OFBIZ-12047)

Added removal of the _PREVIOUS_REQUEST_ attribute when requesting
non-authenticated sites and moved targetRequestUri handling to a
accommodate this change
2021-02-03 11:50:55 +01:00
Michael Brohl c7f4a27f66 Fixed: Possible NPE in DatabaseUtil.getColumnInfo(...) (OFBIZ-11385)
Manually backported to 18.12 because of code differences.
2021-02-01 17:43:19 +01:00
Wiebke Pätzold b19c0d3173 Improved: Spelling error in the German translation of Slovakia
(OFBIZ-12161)
2021-01-28 18:16:17 +01:00
Daniel Watford a6ffc0087c Fixed: Use data url scheme for logo in CompanyHeader
(OFBIZ-7327)

Use a data URL rather than a regular URL for company logos when a
logo has been specified as a Party Content item. This works around the
problem of Apache FOP failing to retrieve content from HTTPS URLs.

Thanks: Deepak Dixit for the review and suggestions
2021-01-24 17:05:59 +00:00
Jacques Le Roux a5fdd7b063 Fixed: Ampersand in Party not displayed correctly (OFBIZ-12140)
In the reported case, ModelFormField::getDescription double HTML encodes the
description when both the entity and the description contain an ampersand.

A solution is to test if the description is already HTML encoded before encoding
it again. If HTML encoded then only String encodes it.

BTW I'm not sure it's useful but it's harmless, the same solution can be applied
to OFBIZ-12026 and similarly in renderableFtlFormElementsBuilder::encode. I'll
do as improvements...

Thanks: Andrew Waters for report and help in analysis
2021-01-23 17:49:35 +01:00
Jacques Le Roux b7ee7fc397 Fixed: Creating a new Customer create a wrong record in CommunicationEvent (OFBIZ-12142)
In https://markmail.org/message/pf3d3qyjfucicbj7 I initially answered:
In demo data 13 parties use <<infoString="ofbiztest@example.com">> as in
<ContactMech contactMechId="FRA01" contactMechTypeId="EMAIL_ADDRESS" infoString="ofbiztest@example.com"/>
This one is loaded last. Rather
<ContactMech contactMechId="Company" contactMechTypeId="EMAIL_ADDRESS" infoString="ofbiztest@example.com"/>
which is the 1st one, should be loaded last.

A better solution is to use "ofbizsupport@example.com" in EmailServices.xml

Indeed, fortunately the Company party also uses this infoString and using it in
EmailServices.xml does not affect the integration test and should not affect
other parts of the (only) demo data

Thanks: Emad Radwan for opiniated report :) and Pritam Kute for issue analysis
2021-01-18 20:13:32 +01:00
Jacques Le Roux 80740645a6 Fixed: partymgr fails to upload image (OFBIZ-12101)
This is a bug due to OFBIZ-12080, fileToCheck is the complete name of the file
with path not the filename

Thanks: Wai for report
2020-12-26 09:07:38 +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 e3c274128b Fixed: Secure the uploads (OFBIZ-12080)
According to https://s.apache.org/rpzog, adds few, maybe redundant, Java
API/methods found in webshell, or alike, source code
2020-12-14 19:01:06 +01:00
Jacques Le Roux 16ffa216d9 Fixed: Secure the uploads (OFBIZ-12080)
Follows OWASP advice on file names:

All the control characters and Unicode ones should be removed from the filenames
and their extensions without any exception. Also, the special characters such as
“;”, “:”, “>”, “<”, “/” ,”\”, additional “.”, “*”, “%”, “$”, and so on should be
discarded as well.

If it is applicable and there is no need to have Unicode characters, it is
highly recommended to only accept Alpha-Numeric characters and only 1 dot as an
input for the file name and the extension; in which the file name and also the
extension should not be empty at all
(regular expression: [a-zA-Z0-9]{1,200}.[a-zA-Z0-9]{1,10}).

So if someone needs other chars in uploaded filenames a change will be needed
2020-12-14 16:51:32 +01:00
Jacques Le Roux b159dffb15 Fixed: Secure the uploads (OFBIZ-12080)
Prevents too long filenames as recommended by OWASP.

Based on https://security.stackexchange.com/questions/46484/denial-of-service-when-uploading-a-file#answer-46495
I decided to not limit sizes of files. Anyway we know it's only post-auth...
2020-12-14 12:48:06 +01:00
Jacques Le Roux 2c4824f9fa Fixed: Hyperlink title under form widget doesn't support character encoding for special characters (OFBIZ-12026)
When we use any title with special characters for hyperlink tag, it shows broken
string on UI, eg:
<hyperlink description="${uiLabelMap.CommonImportExport}"  target="ImportExport">
should render a button with the title "Import/Export. But it shows as
Import&#x2f;Export

jleroux: I have noticed that the same happens with special French characters.
So it's a general issue.
The title (description in code) is HTML encoded and that does not work for
special characters. I simply used a string encoder.

Thanks: Pradeep Choudhary for report, Sourabh Jain for a possible but not
general solution at OFBIZ-12023, ie using target-type="plain"
2020-12-11 13:42:51 +01:00
Jacques Le Roux b57c563e89 Fixed: Secure the uploads (OFBIZ-12080)
module should be MODULE in SecuredUpload class

Improves: add adio adn video to supported file formats in security.properties
2020-12-07 19:43:57 +01:00
Jacques Le Roux 80709b7da9 Fixed: Secure the uploads (OFBIZ-12080)
Handles audio and video formats supported by Tika.

Adds few new audio and video formats in seed data.

AFAIK there are no ways to embed a webshell in an audio or video file. So I did
not sophisticate the validation, just rely on Tika.

I have also fixed bugs in SecuredUpload: in isValidSvgFile and
isValidImageIncludingSvgFile
2020-12-07 15:10:43 +01:00
Jacques Le Roux 1b9784dcdf Fixed: Secure the uploads (OFBIZ-12080)
Improves the labels names and format comment in LayoutEvents.java

I backport to ease later works...
2020-12-06 11:17:46 +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
Deepak Dixit 27d406cd19 Improved: Update IND Geo data as per 2020-11-24 notification (#242)
- Deletion of Union territory IN-DD, IN-DN;
- Addition of Union territory IN-DH;
- Correction of spelling for IN-AR, IN-BR, IN-CH, IN-CT, IN-DH, IN-GJ, IN-HP, IN-HR, IN-JH, IN-JK, IN-KA, IN-LA, IN-MH, IN-ML, IN-NL, IN-RJ, IN-TG, IN-TN, IN-UT;
2020-11-28 12:39:45 +05:30
Jacques Le Roux 792f45773f Fixed: Prevent arbitary file write using webtools/control/EntitySQLProcessor. (OFBIZ-12057)
Shuibo Ye <shuiboye@gmail.com> reported a possible arbitary file write using
webtools/control/EntitySQLProcessor.

    In the "SQL Command" part, I create a table and insert some strings and
    export the table to a file one sentence at a time.
    PoC: CREATE TABLE "test" (string VARCHAR(80))
    INSERT INTO "test" (string) VALUES ('<%= system.getProperty("user.dir") %>')
    call SYSCS_UTIL.SYSCS_EXPORT_TABLE(null,'test','.\framework\webtools\webapp\webtools\default.jsp',null,'*',null)

    After executing the three sentences,I successfully write the file and its url
    is https://localhost:8443/webtools/default.jsp.

I fixed it preventing execution on SYSCS_UTIL.SYSCS_EXPORT_TABLE and JSP, more
could be added if necessary
2020-11-16 14:08:53 +01:00
Jacques Le Roux 0b26b9155f Improved: Prevent possible post-auth RCE from webtools/control/ProgramExport (OFBIZ-12055)
This was reported to the security team by Shuibo Ye <shuiboye@gmail.com>.
We did not create a CVE because it's a post-auth "vulnerability"

Thanks: Shuibo Ye
2020-11-14 11:56:52 +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
holivier 009beb4b11 Improvement: Error messages when generating HTML and PDF file from AsciiDoc files (OFBIZ-11893)
minor correction, title level and anchor definition
2020-10-05 11:20:31 +02:00