Commit Graph
1677 Commits
Author SHA1 Message Date
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
Jacques Le Roux 8f76ba6c67 "Applied fix from trunk for revision: 1859968"
------------------------------------------------------------------------
r1859968 | jleroux | 2019-05-25 15:25:34 +0200 (sam. 25 mai 2019) | 16 lignes

Fixed: Services allow arbitrary HTML for parameters with allow-html set to "safe"
(OFBIZ-5254)

The testCreateNewRequest was failing due to escaped single quotes in related
data in OrderTypeData.xml:
subject="OFBiz - Your Request is received: '${custRequestName}' #CR${custRequestId}"

This was a peculiar case that could be generalised to all escapable characters.
The general solution is to compare the original value with the filtered value 
unescaped in UtilCodec::checkStringForHtmlSafe.
BTW, weirdly enough StringEscapeUtils::escapeHtml4 does not escape single quote.

Another weirdness is the test was passing with plugins data loaded. This is due
to duplicated demo data in scrumTypeData.xml (which is actually not only type
data, as ever the scrum component is a mess, that's not new and always wonder
if we should not get rid of it!)
------------------------------------------------------------------------


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/branches/release18.12@1859969 13f79535-47bb-0310-9956-ffa450edef68
2019-05-25 13:34:45 +00:00
Jacques Le Roux 17e47b6730 "Applied fix from trunk for revision: 1859882"
------------------------------------------------------------------------
r1859882 | jleroux | 2019-05-24 16:16:39 +0200 (ven. 24 mai 2019) | 5 lignes

Improved: no functional change

Javadoc was unhappy: 
CustomPermissivePolicy.java:13: error: element not closed: blockquote

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


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/branches/release18.12@1859883 13f79535-47bb-0310-9956-ffa450edef68
2019-05-24 14:17:04 +00:00
Jacques Le Roux daa2c243a9 "Applied fix from trunk for revision: 1859877"
------------------------------------------------------------------------
r1859877 | jleroux | 2019-05-24 15:47:08 +0200 (ven. 24 mai 2019) | 10 lignes

Fixed: Services allow arbitrary HTML for parameters with allow-html set to "safe"
(OFBIZ-5254)

This was reopened after discussion at 
https://markmail.org/message/jnaitmwahjcjmdn5

This is a new solution which follows the work done with OFBIZ-6669 and OFBIZ-10187
Roughly said, it uses org.owasp.html.PolicyFactory and org.owasp.html.Sanitizers

Thanks: Christoph Neuroth for report
------------------------------------------------------------------------


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/branches/release18.12@1859878 13f79535-47bb-0310-9956-ffa450edef68
2019-05-24 13:51:26 +00:00
Jacques Le Roux d347fa1d62 "Applied fix from trunk for revision: 1859871"
------------------------------------------------------------------------
r1859871 | jleroux | 2019-05-24 15:24:31 +0200 (ven. 24 mai 2019) | 14 lignes

Fixed: OWASP sanitizer breaks proper rendering of HTML code
(OFBIZ-10187)

After a discussion with Dennis, I checked and the pattern ONSITE_URL would be 
useless without 

.allowAttributes("background").matching(ONSITE_URL)
.onElements("table")
.allowAttributes("background").matching(ONSITE_URL)
.onElements("td", "th", "tr")

So here they are

Thanks: Dennis Balkir for discussion
------------------------------------------------------------------------


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/branches/release18.12@1859872 13f79535-47bb-0310-9956-ffa450edef68
2019-05-24 13:27:35 +00:00
Mathieu Lirzin 4fd92eea61 Fixed: Fix javadoc build for OpenJDK 11
(OFBIZ-10757)

This removes HTML5 deprecated stuff such as ‘<tt>’ elements, and
‘cellpadding’ table attributes which were breaking the ‘:javadoc’
Gradle task when using OpenJDK 11.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/branches/release18.12@1859124 13f79535-47bb-0310-9956-ffa450edef68
2019-05-11 20:40:37 +00:00
Jacques Le Roux bdfc43319f "Applied fix from trunk for revision: 1858483"
------------------------------------------------------------------------
r1858483 | mthl | 2019-05-01 14:55:51 +0200 (mer. 01 mai 2019) | 7 lignes

Improved: Remove unneeded generics in ‘MapContextTest’
(OFBIZ-10933)

This is done to remove a warning in OpenJDK 8 which doesn't seem to
handle ‘@safevarargs’ annotation properly when using generics.  This
warning was not present with OpenJDK 11.

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


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/branches/release18.12@1858979 13f79535-47bb-0310-9956-ffa450edef68
2019-05-09 09:01:19 +00:00
Jacques Le Roux f6206c1774 "Applied fix from trunk for revision: 1858965"
------------------------------------------------------------------------
r1858965 | jleroux | 2019-05-09 08:05:05 +0200 (jeu. 09 mai 2019) | 18 lignes

Fixed: Product content management screen doesn't validate trusted users' input
(OFBIZ-10054)

Steps to recreate:
1) go to (authenticate with admin/ofbiz):
https://localhost:8443/catalog/control/EditProductContent?productId=WG-1111

2) set the content of the field labeled "Large Image" to:
non_existent.foo" onerror="alert('Hi!');

3) visit the url:
https://localhost:8443/ecommerce/control/product?product_id=WG-1111

A popup message will appear with the "Hi!".

jleroux: This is fixed by preventing any js event to be passed 

Thanks: Loris Nardo for report, Jacopo and Gregory for discussion
------------------------------------------------------------------------


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/branches/release18.12@1858966 13f79535-47bb-0310-9956-ffa450edef68
2019-05-09 06:05:57 +00:00
Mathieu Lirzin 9ba89ba677 Improved: Rewrite ‘CustomPermissivePolicy#matchesEither’ static method
(OFBIZ-10187)

It now uses a lambda expression instead of an anonymous class.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/branches/release18.12@1858934 13f79535-47bb-0310-9956-ffa450edef68
2019-05-08 17:11:35 +00:00
Mathieu Lirzin c1caad3442 Improved: Add missing ‘synchronized’ modifier
(OFBIZ-11004)

Overriding a synchronized method with a non-synchronized one can
introduce potential runtime concurrency bugs. Since
‘ExtendedProperties#loadFromXML’ is overridding
‘Properties#loadFromXML’ which is synchronized, it is safer to mark it
as synchonized.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/branches/release18.12@1858928 13f79535-47bb-0310-9956-ffa450edef68
2019-05-08 15:16:59 +00:00
Jacques Le Roux 7752eb62da "Applied fix from trunk for revision: 1857088"
------------------------------------------------------------------------
r1857088 | mthl | 2019-04-08 00:11:53 +0200 (lun. 08 avr. 2019) | 6 lignes

Fixed: Remove redundant interface declaration (OFBIZ-10910)

‘java.io.ObjectInputStream’ already implements the ‘AutoCloseable’
interface, so there is no need to declare it in
‘SafeObjectInputStream’ which extends this class.

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


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/branches/release18.12@1858866 13f79535-47bb-0310-9956-ffa450edef68
2019-05-07 15:00:36 +00:00
Michael Brohl bb9d58f13e Fixed: OWASP sanitizer breaks proper rendering of HTML code
(OFBIZ-10187)

This makes the sanitizing enabled/disabled by configuration and enhances
the functionality to support custom sanitizer policies. A reasonable 
example policy class is also included.

Thanks Dennis Balkir for reporting and providing the patch.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/branches/release18.12@1858353 13f79535-47bb-0310-9956-ffa450edef68
2019-04-29 09:40:15 +00:00
Swapnil Mane 626fb28672 Applied fix from trunk for revision: 1858035
===

Fixed: Parameters are not available to the next response type when form of enctype=multipart/form-data type is submitted
(OFBIZ-10833)

Reason: The UtilHttp.getMultiPartParameterMap method is used to get the parameters in case of multipart/form-data type.
The getMultiPartParameterMap parse the request to get the parameters.

{code}
uploadedItems = UtilGenerics.<FileItem>checkList(upload.parseRequest(request));
{code}

As per the Apache commons-fileupload guideline, a request can only be parsed once [1]. So, for the next response, again the same getMultiPartParameterMap method is executed (with the same request object), and no parameters are found, since, the request is already parsed.

Also, have a look at the StackOverflow question [2], it also contains related information.

Fix for the issue:
Set the consumed parameters (except uploaded file(s)) in the request attribute so that it will be available to the next response.
The uploaded file(s) are not set in request attribute again to avoid unnecessary memory consumption, also it makes no sense to traverse the uploaded file in the request.

[1] http://commons.apache.org/proper/commons-fileupload/faq.html#empty-parse

[2] https://stackoverflow.com/questions/13881272/servletfileuploadparserequestrequest-returns-an-empty-list

Thanks: Ingo Wolfmayr for reporting issue and Jacques Le Roux for review.



git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/branches/release18.12@1858036 13f79535-47bb-0310-9956-ffa450edef68
2019-04-24 10:05:12 +00:00
Mathieu Lirzin 50310c5703 Fixed: Ensure that ‘MapContext’ preserves insertion order properties
(OFBIZ-10933)

This fixes a regression introduced in revision 1837462.

When pushing a ‘LinkedHashMap’ inside a ‘MapContext’, the iteration
order of the ‘MapContext’ values was not corresponding to the
insertion order of the embedded ‘LinkedHashMap’ which is important in
the ‘ControllerConfig’ case where configuration elements are stored in
‘LinkedHashMap’ objects and the ‘include’ mechanism relies on
‘MapContext’.

To avoid such regression in the future, a test reproducing the bug has
been added.

Thanks: Gil Portenseigne for investigating.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/branches/release18.12@1857820 13f79535-47bb-0310-9956-ffa450edef68
2019-04-19 15:29:52 +00:00
Mathieu Lirzin b8f0d689d1 Improved: Add ‘UtilMisc#toMap(Supplier<Map<K, V>>, Object...)’
(OFBIZ-10933)

It is convenient to use ‘UtilMisc#toMap’ to create pseudo-literal
maps. Previously it was not possible to specify the concrete class of
the constructed map.  The ‘UtilMisc#toMap(Supplier<Map<K, V>>,
Object...)’ overload now provides a convenient way to instantiate
specific map types like ‘LinkedHashMap’ objects.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/branches/release18.12@1857819 13f79535-47bb-0310-9956-ffa450edef68
2019-04-19 15:26:54 +00:00
Jacques Le Roux cbab9e6a45 "Applied fix from trunk for revision: 1857099"
------------------------------------------------------------------------
r1857099 | jleroux | 2019-04-08 11:17:55 +0200 (lun. 08 avr. 2019) | 12 lignes

Improved: Using try-with-resources with File IO Objects.
(OFBIZ-9855)

Uses try with resources for File IO objects like ObjectInputStream and other 
objects. File classes have the AutoCloseable interface.

jleroux: this is only a part of the 2nd patch. The 1st patch will be committed
soon too...

All tests pass

Thanks: Pradhan Yash Sharma
------------------------------------------------------------------------


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/branches/release18.12@1857486 13f79535-47bb-0310-9956-ffa450edef68
2019-04-13 17:50:10 +00:00
Jacques Le Roux 07445e768d "Applied fix from trunk for revision: 1857392 "
------------------------------------------------------------------------
r1857392 | jleroux | 2019-04-12 11:29:03 +0200 (ven. 12 avr. 2019) | 14 lignes

Improved: Improve ObjectInputStream class
(OFBIZ-10837)

Fixes CVE-2019-0189

Cleans and simplifies things in UtilObject.java and also handles patterns. 
That's what we missed most when needing to update.

Fixes typos in SafeObjectInputStream class and add a commented line for a WIP in
resolveProxyClass method

Also includes work done in UtilObject.java for OFBIZ-9855 
"Using try-with-resources with File IO Objects."



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


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/branches/release18.12@1857393 13f79535-47bb-0310-9956-ffa450edef68
2019-04-12 09:29:47 +00:00
Jacques Le Roux afe6e8ad20 "Applied fix from trunk for revision: 1856484"
------------------------------------------------------------------------
r1856484 | jleroux | 2019-03-28 16:36:13 +0100 (jeu. 28 mars 2019) | 13 lignes

Improved: Improve ObjectInputStream class
(OFBIZ-10837)

Fixes CVE-2019-0189

The white list was still not complete as reported by Ed Mack
This adds 
org.apache.ofbiz.widget.model.ModelTheme
java.util.Collections 
java.util.LinkedList 
java.util.ArrayList
java.util.TimeZonz


Thanks: Ed Mack at OFBIZ-10876
------------------------------------------------------------------------


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/branches/release18.12@1856485 13f79535-47bb-0310-9956-ffa450edef68
2019-03-28 15:37:07 +00:00
Jacques Le Roux d3669f8166 "Applied fix from trunk for revision: 1856460"
------------------------------------------------------------------------
r1856460 | jleroux | 2019-03-28 09:30:21 +0100 (jeu. 28 mars 2019) | 10 lignes

Improved: Improve ObjectInputStream class
(OFBIZ-10837)

Fixes CVE-2019-0189

There was a recurring typo in previous commit.
For arrays of primitives it should be 
"\\[Z","\\[B","\\[S","\\[I","\\[J","\\[F","\\[D","\\[C"
and not 
"[Z","[B","[S","[I","[J","[F","[D","[C"
It shows how tired I'm :/

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


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/branches/release18.12@1856461 13f79535-47bb-0310-9956-ffa450edef68
2019-03-28 08:30:57 +00:00
Jacques Le Roux 2f39797e50 "Applied fix from trunk for revision: 1856455"
------------------------------------------------------------------------
r1856455 | jleroux | 2019-03-28 08:50:32 +0100 (jeu. 28 mars 2019) | 7 lignes

Improved: Improve ObjectInputStream class
(OFBIZ-10837)

Fixes CVE-2019-0189

The white list was still not complete as reported by Ed Mack
This adds all arrays of primitives and java.math.BigDecimal 

Thanks: Ed Mack at OFBIZ-10876
------------------------------------------------------------------------


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/branches/release18.12@1856456 13f79535-47bb-0310-9956-ffa450edef68
2019-03-28 07:52:06 +00:00
Jacques Le Roux 181da99a6a "Applied fix from trunk for revision: 1856405"
------------------------------------------------------------------------
r1856405 | jleroux | 2019-03-27 15:16:24 +0100 (mer. 27 mars 2019) | 12 lignes

Improved: Improve ObjectInputStream class
(OFBIZ-10837)

Fixes CVE-2019-0189

The white list was still not complete as reported by Wolfgang Rauchholz on user
ML 
This adds java.math.BigDecimal and "[B" (ie [B == byte[] and I don't understand
why in this case "byte[]" does not work)

It seems the warning in SafeObjectInputStream::resolveClass is not enough. 
Anyway I'll not change it.

Thanks: Ingo Wolfmayr at OFBIZ-10870
------------------------------------------------------------------------


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/branches/release18.12@1856406 13f79535-47bb-0310-9956-ffa450edef68
2019-03-27 14:25:01 +00:00
Swapnil Mane fe50928e44 Applied fix from trunk for revision: 1855898
===

Improved: Moved the nodeType check after node.getTextContent() method call
(OFBIZ-10832)

Since most nodes will contain text then it will be more efficient to do a null check after retrieving nodeValue.

Thanks: Scott for your valuable inputs.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/branches/release18.12@1855899 13f79535-47bb-0310-9956-ffa450edef68
2019-03-20 12:17:51 +00:00
Jacques Le Roux 8badcf709b "Applied fix from trunk for revision: 1855492"
------------------------------------------------------------------------
r1855492 | jleroux | 2019-03-14 09:28:27 +0100 (jeu. 14 mars 2019) | 11 lignes

Improved: Improve ObjectInputStream class
(OFBIZ-10837)

Fixes CVE-2019-0189

The white list was still not complete as reported by Wolfgang Rauchholz on user
ML 
This adds java.util.Date

It seems the warning in SafeObjectInputStream::resolveClass is not enough. 
Anyway I'll not change it.

Thanks: Wolfgang Rauchholz
------------------------------------------------------------------------


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/branches/release18.12@1855493 13f79535-47bb-0310-9956-ffa450edef68
2019-03-14 08:28:47 +00:00
Jacques Le Roux f772c0596d "Applied fix from trunk for revision: 1855488"
------------------------------------------------------------------------
r1855488 | jleroux | 2019-03-14 08:42:17 +0100 (jeu. 14 mars 2019) | 11 lignes

Improved: Improve ObjectInputStream class
(OFBIZ-10837)

Fixes CVE-2019-0189

The white list was still not complete as reported by Wolfgang Rauchholz on user
ML 
This adds java.sql.Timestamp

It seems the warning in SafeObjectInputStream::resolveClass is not enough. 
Anyway I'll not change it.

Thanks: Wolfgang Rauchholz
------------------------------------------------------------------------


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/branches/release18.12@1855489 13f79535-47bb-0310-9956-ffa450edef68
2019-03-14 07:43:15 +00:00
Swapnil Mane f01e4cf67c Applied fix from trunk for revision: 1855403
===

Fixed: simpleTypeConvert always returns Null for Document, Document Type and Notation Node 
(OFBIZ-10832)

As per the code, getTextContent() method is used get text content of the node and its descendants but the node.getTextContent() always return Null for the following Node type
DOCUMENT_NODE, DOCUMENT_TYPE_NODE, NOTATION_NODE [1]

Since we can't get the text value of Document, Document Type and Notation Node, thus simply return the same object.

[1] https://docs.oracle.com/javase/7/docs/api/org/w3c/dom/Node.html#getTextContent()

Thanks: Deepak Dixit for reviewing the code.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/branches/release18.12@1855408 13f79535-47bb-0310-9956-ffa450edef68
2019-03-13 12:34:45 +00:00
Jacques Le Roux 8dc982f2b3 "Applied fix from trunk for revision: 1855371"
------------------------------------------------------------------------
r1855371 | jleroux | 2019-03-13 09:19:32 +0100 (mer. 13 mars 2019) | 10 lignes

Improved: Improve ObjectInputStream class
(OFBIZ-10837)

Fixes CVE-2019-0189

The white list was still not complete as reported by Deepak at OFBIZ-10837
This adds sun.util.calendar.ZoneInfo

It seems the warning in SafeObjectInputStream::resolveClass is not enough. 
Anyway I'll not change it.

Thanks: Deepak Dexit
------------------------------------------------------------------------


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/branches/release18.12@1855372 13f79535-47bb-0310-9956-ffa450edef68
2019-03-13 08:20:02 +00:00
Jacques Le Roux cd6625491b "Applied fix from trunk for revision: 1855287"
------------------------------------------------------------------------
r1855287 | jleroux | 2019-03-12 09:29:37 +0100 (mar. 12 mars 2019) | 10 lignes

Improved: Improve ObjectInputStream class
(OFBIZ-10837)

Fixes CVE-2019-0189

The white list was still not complete as reported by Rohit at OFBIZ-10573
This adds FlexibleStringExpander

It seems the warning in SafeObjectInputStream::resolveClass is not enough. 
Anyway I'll not change it.

Thanks: Rohit Koushal
------------------------------------------------------------------------


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/branches/release18.12@1855288 13f79535-47bb-0310-9956-ffa450edef68
2019-03-12 08:30:01 +00:00
Deepak Dixit adeac89d37 Applied fix from trunk for revision: 1854683
===

Preparation for JDK11 update, Updated following code to fix warning with respect to JDK11
- Replaced Class::newInstance occurrences
- Removed deprecated override method Object::finalize
(OFBIZ-10757)

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/branches/release18.12@1854689 13f79535-47bb-0310-9956-ffa450edef68
2019-03-03 10:45:02 +00:00
Jacques Le Roux bd35056b3f "Applied fix from trunk for revision: 1853745 "
------------------------------------------------------------------------
r1853745 | jleroux | 2019-02-17 13:38:06 +0100 (dim. 17 févr. 2019) | 8 lignes

Improved: Improve ObjectInputStream class
(OFBIZ-10837)

Fixes CVE-2019-0189

The white list I used was not complete.
This adds "java.util.HashMap", "Boolean", "Number", "Integer" which are the ones
missing I found so far. 
Maybe other classes could still miss OOTB. So I added a warning in 
SafeObjectInputStream::resolveClass
------------------------------------------------------------------------


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/branches/release18.12@1853746 13f79535-47bb-0310-9956-ffa450edef68
2019-02-17 12:39:54 +00:00
Jacques Le Roux b9480dae29 "Applied fix from trunk for revision: 1853691 "
------------------------------------------------------------------------
r1853691 | jleroux | 2019-02-16 10:42:03 +0100 (sam. 16 févr. 2019) | 9 lignes

Improved: Improve ObjectInputStream class
(OFBIZ-10837)

Fixes CVE-2019-0189

As reported by FindBugs and Sonar, it's troubling (a Bad practice in Sonar[1], 
a code smell in Findbugs[2]) when extending to use the same name than the 
extended Object

[1] https://sbforge.org/sonar/rules/show/findbugs:NM_SAME_SIMPLE_NAME_AS_SUPERCLASS?layout=false
[2] https://logging.apache.org/log4j/log4j-2.2/log4j-jul/findbugs.html
------------------------------------------------------------------------


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/branches/release18.12@1853692 13f79535-47bb-0310-9956-ffa450edef68
2019-02-16 09:43:39 +00:00
Jacques Le Roux 191f9272ef "Applied fix from trunk for revision: 1851998"
------------------------------------------------------------------------
r1851998 | jleroux | 2019-01-24 09:17:38 +0100 (jeu. 24 janv. 2019) | 11 lignes

Fixed: Impossible secure and autologin cookie names when mountpoint contains a 
slash inside its name
(OFBIZ-10766)

Deepak Nigam reported on dev ML:
When there is one web app with the empty mount point (i.e. deployed on root), 
the auto-login cookie will not work for that particular webapp due to the change 
in the path of the cookie from "/" to "/" + applicationName. Because the system 
will try to find the cookie at the "/" but it is actually at "/" + applicationName.

Thanks Deepak for report
------------------------------------------------------------------------


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/branches/release18.12@1851999 13f79535-47bb-0310-9956-ffa450edef68
2019-01-24 08:19:12 +00:00
Jacques Le Roux df2e8c2fa4 "Applied fix from trunk for revision: 1851200"
------------------------------------------------------------------------
r1851200 | jleroux | 2019-01-13 14:31:13 +0100 (dim. 13 janv. 2019) | 11 lignes

Reverted: Impossible secure and autologin cookie names when mountpoint contains 
a slash inside its name
(OFBIZ-10766)

In my previous commit I reverted the initial change. As I said in the Jira
I had a second look and it's better to fix the problem at the root as I did 
initially. 

I wrote in my previous commit: "This method is used in other places where the 
name should not be changed." I checked there are no issues changing slashes to
underscores in the cookies names anywhere.
------------------------------------------------------------------------


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/branches/release18.12@1851201 13f79535-47bb-0310-9956-ffa450edef68
2019-01-13 13:33:23 +00:00
Jacques Le Roux de31245d5e "Applied fix from trunk for revision: 1850685"
------------------------------------------------------------------------
r1850685 | jleroux | 2019-01-07 21:37:10 +0100 (lun. 07 janv. 2019) | 8 lignes

Fixed: Impossible secure and autologin cookie names when mountpoint contains a 
slash inside its name
(OFBIZ-10766)

My previous commit was wrong this one fixes it.
I made a mistake trying to generalise changing UtilHttp::getApplicationName. 
This method is used in other places where the name should not be changed. 
Only cookies are concerned.
------------------------------------------------------------------------


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/branches/release18.12@1850686 13f79535-47bb-0310-9956-ffa450edef68
2019-01-07 20:38:26 +00:00
Jacques Le Roux a51ea1af60 "Applied fix from trunk for revision: 1850530"
------------------------------------------------------------------------
r1850530 | jleroux | 2019-01-06 09:40:38 +0100 (dim. 06 janv. 2019) | 8 lignes

Fixed: Impossible secure and autologin cookie names when mountpoint contains a 
slash inside its name
(OFBIZ-10766)

When you set a mountpoint which contains a slash inside its name 
(ie not only a slash as a trailer, which is possible), as it's needed with 
OFBIZ-10765, OFBiz tries to create a cookie with a slash in its name and 
that's impossible
------------------------------------------------------------------------


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/branches/release18.12@1850531 13f79535-47bb-0310-9956-ffa450edef68
2019-01-06 08:41:19 +00:00
Jacques Le Roux 9b298ce6d5 "Applied fix from trunk for revision: 1850015"
------------------------------------------------------------------------
r1850015 | jleroux | 2018-12-31 07:38:36 +0100 (lun. 31 déc. 2018) | 16 lignes

Improved: Prepare the migration to XStream 1.5
(OFBIZ-10756)

Fixes CVE-2018-17200

We currently use the UnsupportedClassConverter method in UtilXml class. 
When the 1.5 version of XStream will be available another way to handle this 
kind of things will be available and used by default. It's already possible to 
use the same with the 1.4 version of XStream with its setupDefaultSecurity method.

So this replaces the UnsupportedClassConverter in UtilXml class by 
XStream::setupDefaultSecurity method.

It's an improvement but better to backport it as much as possible

The UtilXmlTests class and its use is removed and the UnsupportedClassConverter 
method deprecated (no use OOTB)


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


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/branches/release18.12@1850018 13f79535-47bb-0310-9956-ffa450edef68
2018-12-31 06:51:08 +00:00
Aditya Sharma 0abeb293a8 Improved: Refactor boolean returns for UtilHttp methods
(OFBIZ-10726)
Improves code in isJavaScriptEnabled()
Instead of using if-else block, a ternary operator is used for improving readability.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1849738 13f79535-47bb-0310-9956-ffa450edef68
2018-12-26 04:56:33 +00:00
Aditya Sharma 4b677ab1de Improved: Refactor boolean returns for UtilHttp methods
(OFBIZ-10726)
Improved boolean returns with single statement, replacing if blocks with explicit boolean return. Improves code in checkURLforSpiders().

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1849675 13f79535-47bb-0310-9956-ffa450edef68
2018-12-24 09:02:54 +00:00
Aditya Sharma 4487e3ccb0 Improved: Refactor boolean returns for UtilValidate methods
(OFBIZ-10728)
Improved boolean returns with single statement, replacing if blocks with explicit boolean return.
Improves code in isGiftCard().
Thanks Suraj Khurana for the review.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1849673 13f79535-47bb-0310-9956-ffa450edef68
2018-12-24 07:51:53 +00:00
Jacques Le Roux 0fb2991e16 FIxed: Replace Callable objects with lambda expressions
(OFBIZ-10488)

urlExists in UelFunctions is not used at all OOTB but its initialisation 
remained


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1848674 13f79535-47bb-0310-9956-ffa450edef68
2018-12-11 13:49:51 +00:00
Jacques Le Roux bbfc62d47a Improved: Fix or Silence various warnings
(OFBIZ-10701)

In order to detect potential issues early, the linting compiler option should be 
used by default and disabled with {{./gradlew -PXlint:none build}}.

Additionally it is important to reduce the number of warnings otherwise new 
warnings will remain unnoticed.

The warning related to the com.googlecode.concurrentlinkedhashmap dependency 
should resolves itself once we handle upgrade to Caffeine like proposed in 
OFBIZ-6747.

Thanks: Mathieu Lirzin

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1848673 13f79535-47bb-0310-9956-ffa450edef68
2018-12-11 13:33:49 +00:00
Jacques Le Roux a05421414d Fixed: Create a PoC for a documentation system for OFBiz based on Asciidoc
(OFBIZ-9873)

I wrongly added ServerTableEntryTest.java at some point, this removes it

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1847891 13f79535-47bb-0310-9956-ffa450edef68
2018-12-01 12:35:17 +00:00
Jacques Le Roux 426df38d97 Fixed: Create a PoC for a documentation system for OFBiz based on Asciidoc
(OFBIZ-9873)

At r1831619 we committed a workaround to "turn off PDF in windows for now"

I have found a real solution for this bug which prevents to check PDF results in 
Windows because the PDF were not generated there.

I found this solution at 
https://github.com/asciidoctor/asciidoctorj-pdf/issues/8. 
After reading https://github.com/asciidoctor/asciidoctor-pdf/issues/850 
I checked it also works on Linux.

It uses the last version of jruby-complete.

I guess the gradle-versions-plugin should be able to warn us when an upgrade of 
jruby-complete is available like it does for junitReport.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1847890 13f79535-47bb-0310-9956-ffa450edef68
2018-12-01 12:30:50 +00:00
Jacques Le Roux b31fd85dc1 Improved: Multi Part Input Parameters not Available in Groovy Event
(OFBIZ-5048)

If a form is of type enctype="multipart/form-data" and we are handling its 
submission through Groovy Event then in the parameters Map Ofbiz does not set 
the multipart input parameters from request parameters.

The same are available when multipart form submission is handled through service.

The reason being the code that sets the multipart parameters in request 
attribute is only available in ServiceEventHandler.java and in 
GroovyEventHandler the multipart are never set.

So I have created a method getMultiPartParameterMap in the class UtilHttp.java 
and put the common logic in that method so that when getCombinedMap method is 
called from the GroovEventHandler the method also call getMultiPartParameterMap 
and in the ServiceEventHandler I have written a call for 
getMultiPartParameterMap method.

Thanks: Vikramjit Singh for report and initial patch, Rohit Koushal for updated
and revised patch with some minor changes.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1847478 13f79535-47bb-0310-9956-ffa450edef68
2018-11-26 16:41:52 +00:00
Aditya Sharma 780cc1af3e Fixed: Missing Security and Cache Headers in CMS Events
(OFBIZ-10597)
Instead of having multiple null checks for viewMap separately for each security header we can have a single combined null check at the top in setResponseBrowserDefaultSecurityHeaders() method.

With increasing security headers these may become expensive.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1846632 13f79535-47bb-0310-9956-ffa450edef68
2018-11-15 10:40:55 +00:00
Jacques Le Roux c1d09961dd Improved: Clean some Groovy files in base component
(OFBIZ-10646)

Following discussion at https://markmail.org/message/y3izmnxd7jd6jbkf 
this cleans some Groovy files in the base component, notably:

* remove ant-scripts folder and its content.
* Rename framework/base/groovyScript to framework/base/groovyScripts;
* Move GroovyInit.groovy and GroovyServiceTest.groovy respectively to 
  framework/base/groovyScripts and framework/common/groovyScripts 
  and change their paths where used.
* Removes GroovyInit.groovy from excludedConfigFiles in build.gradle
* After OFBIZ-10611 it's possible to move GroovyBaseScript.groovy  from
  framework/service/src/main/java/org/apache/ofbiz/service/engine
  to
  framework/service/src/main/groovy/org/apache/ofbiz/service/engine
* Removes FileUtilTests.groovy from basetests.xml (missed it in OFBIZ-10611)
* Fixes a typo in test-suite.xsd

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1846485 13f79535-47bb-0310-9956-ffa450edef68
2018-11-13 05:03:51 +00:00
Jacques Le Roux 7cc7fd2cea Improved: Allow unit tests to be written in Groovy
(OFBIZ-10611)

Since OFBIZ-9996 it is possible to write integration tests in Groovy, meaning 
test that depend on the dispatcher and the delegator. It would be nice if the 
unit tests could be written in Groovy too.

The major benefit of writing tests in Groovy is that you create inputs and 
expected outputs more easily with objects literals. 
For example the following java code:

Map<String, Integer> input = new HashMap<>();
  input.put("foo", 42);
  input.put("bar", 37);

can be rewritten in Groovy like this:
  def input = [foo: 42, bar: 37]

Thanks: Mathieu Lirzin

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1846393 13f79535-47bb-0310-9956-ffa450edef68
2018-11-12 10:57:27 +00:00
Jacques Le Roux fceb3e087c Improved: remove deprecated and not used PhoneNumber functions
(OFBIZ-10631)

Several phone number validation functions have been deprecated (and are not used in framework code).
This concerns:
    isUSPhoneNumber
    isUSPhoneAreaCode
    isUSPhoneMainNumber
    isInternationalPhoneNumber

Thanks: Pierre Smits

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1846213 13f79535-47bb-0310-9956-ffa450edef68
2018-11-09 08:01:49 +00:00
Jacques Le Roux 03009b3c83 Fixed: Error in GetLocaleListTests.java
(OFBIZ-10641)

A test error related to GetLocaleListTests.java seems to happen only on a fresh 
trunk install when running unit tests. It's no stopping tests. 

I'm not sure yet if R17 is concerned. I did not try, but will 1st confirm with
this commit with trunk demo error.loç

Mathieu suggested to  replace the location 
component://base/config/GroovyInit.groovy 
with ofbizhome://framework/base/config/GroovyInit.groovy
because GroovyUtil [should not] depend on the component container in the 
1st place, and it seems to work.

Thanks: Mathieu for the idea.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1845933 13f79535-47bb-0310-9956-ffa450edef68
2018-11-06 16:33:11 +00:00
Jacques Le Roux 102dd5d242 Fixed: Correct behaviour of Autologin cookies
(OFBIZ-10635)

Renames "keep-autologin-cookie" to "use-autologin-cookie", and only create 
Autologin cookies when needed. No need to create Autologin cookies in 
applications that don't need it.

Don't pass webAppName to LoginWorker::getSecuredUserLoginId, that can be handled
with improved LoginWorker::getSecuredLoginIdCookieName

Removes LoginWorker::autoLogoutCleanCookies, no longer needed since only those
needed are created and kept (1 year at least after creation).

For both autoLogin and securedLoginId cookies sets the path to the application.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1845558 13f79535-47bb-0310-9956-ffa450edef68
2018-11-02 09:46:42 +00:00
Jacques Le Roux a1e28bf1e2 Fixed: ComponentConfig::getAppBarWebInfos creates infos only for components
without <<app-bar-display="false">>
(OFBIZ-10637)

LoginWorked::getAppBarWebInfos is used to define the apps menus in themes so we
need to also check that no menuName is passed to 
ComponentConfig::getAppBarWebInfos. Else all menus appears in the secondary menu
bars


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1845552 13f79535-47bb-0310-9956-ffa450edef68
2018-11-02 08:48:31 +00:00