Commit Graph
2421 Commits
Author SHA1 Message Date
Pawan Verma 6cb67c1a40 Improved: Replace .size() == 0 with isEmpty() in Java files(OFBIZ-11944)
Thanks, priya for the report and patch and jacques for the review.
2020-08-22 19:17:10 +05:30
Suraj Khurana 9689201b84 Improved: Make data members of class as private and added accessor methods for the same, also corrected occurences of the same in framework component.
(OFBIZ-11963)
Also made some related checkstyle code enhancements.
Thanks jacques for finalizing Javadoc pattern during this effort.
2020-08-22 13:20:39 +05:30
Suraj Khurana 8c10d4ae72 Improved: Added missing Javadocs for some methods, this is required for all classes which looks like designed for extension (can be subclassed).
(OFBIZ-11947)
This is done for framework component. Also corrected some variables as per naming convention best practices.
Thanks Jacques for review.
2020-08-17 12:30:26 +05:30
Jacques Le Roux b895a9c889 Improved: Removed unused imports from Java files for fixing checkstyle errors (OFBIZ-11930)
Fixes few javadoc issues

Since this has been ignored for few commits I need to increase
tasks.checkstyleMain.maxErrors from 12224 to 12247 (did not check the detail)
2020-08-08 14:04:08 +02:00
Priya Sharma 5dbf5cb9eb Improved: Removed unused imports from Java files for fixinf checkstyle errors
(OFBIZ-11930)
Thanks: Priya Sharma
2020-08-07 18:57:02 +05:30
Suraj Khurana 33f05c1684 Improved: Corrected all redundant modifiers occurences in framework component. Also, fixed some other checkstyle line formatting and spacing issues.
(OFBIZ-11925)
2020-08-06 18:53:13 +05:30
Jacques Le Roux e8dd3c609c 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.

I have added getEncodedParameter method in UtilHttp and removed now useless
(after OFBIZ-11907) getEnvironment from MacroFormRenderer.java

Thanks: Alvaro for advice
2020-08-03 11:04:58 +02:00
Suraj Khurana 7d82b17c72 Improved: Corrected some line is longer than 150 characters checkstyle issues in framework component. Also fixed some extra spaces and naming conventions related checkstyle issues.
(OFBIZ-11921)
2020-08-03 10:11:40 +05:30
Jacques Le Roux be498295a5 Improved: Update build.gradle to the latest dependencies (OFBIZ-11603)
Fixes some new warnings coming from JUnit 4.13, a step ahead to JUnit 5.

I left 2 complicated ExpectedException  warnings. Change will be needed for JUnit 5.
https://www.luxoft-training.com/news/migrating-from-junit-4-to-junit-5-replacing-rules-with-the-extension-model-part-1/
2020-07-27 16:14:51 +02:00
Suraj Khurana d374019465 Improved: Corrected all incorrect indentation level issues in framework component, also fixed some case indentation checkstyle issues.
(OFBIZ-11922)
2020-07-26 21:04:41 +05:30
Jacques Le Roux 9cbcef3209 Fixed: with "replaces module by MODULE everywhere" I put in a JavaDoc bug.
This fixes it and clarifies things by using className instead of module in code
when used as a var not as the MODULE const.
2020-07-26 10:30:45 +02:00
Suraj Khurana f4f2722d36 Improved: Updated case indentation to 0 for all switch statements in framework component. Also done formatting changes as per checkstyle best practices.
(OFBIZ-11904)
2020-07-25 13:50:37 +05:30
Suraj Khurana 7b251e43d9 Improved: Corrected some single line statements to fix checkstyle issues, also removed some remaining extra spaces from code to avoid checkstyle erros in framework component.
(OFBIZ-11886)
2020-07-21 12:25:20 +05:30
Suraj Khurana 8b1e0dbd85 Improved: Corrected all checkstyle formatting issues: 'typecast' is not followed by whitespace in framework component.
(OFBIZ-11887)
2020-07-18 12:26:42 +05:30
holivier b0f445b123 Documented: Framework, migration all docbook files to asciidoc
(OFBIZ-11587)

- common-sending-email: include in email
- datafile: move as a include at the end of entity-engine section
- entity-engine: list of link to OFBiz wiki about entity configuration
- service-engine: a link to OFBiz wiki Service Engine Guide
- webtools: help for main screen
- mini-lang: include a link to OFBiz wiki mini-lang-reference at the
beginning of minilang-to-groovy-manual
           move minilang-to-groovy-manual to Development environment
section
- unit-test: include as Junit test, and use README to list gradle
command available (so add a tag in REAME.adoc)
- base: add a link to OFBiz wiki Configuration Guide, in deployment
section
- SingleSignOn with LDAP: move to plugin LDAP and include in deployment
section

developer-manual is updated with some include lines or with directly a
sentence.
2020-07-14 16:56:05 +02:00
holivier 5f56177d02 Documented: Framework/base migration to asciidoc
(OFBIZ-11587)

Delete docbook files
2020-07-14 16:53:09 +02:00
holivier 2c700e86af Documented: Framework/base migration to asciidoc
(OFBIZ-11587)

only one file about receiving email, so create email.adoc which included
receiving and later sending.
email.adoc is included in developer-manual.adoc in deployment section
2020-07-14 16:27:23 +02:00
Suraj Khurana 0c37e80036 Improved: Corrected all checkstyle formatting issues: Line has trailing spaces in framework component.
(OFBIZ-11880)
Thanks Jacques for review.
2020-07-13 14:18:24 +05:30
Suraj Khurana dd4da77d76 Improved: Corrected checkstyle formatting issues, 'is preceded/not preceded with whitespace' for framework component.
(OFBIZ-11874)
This fixes following checkstyle issues:
'{' is not preceded with whitespace.
'{' is not followed by whitespace.
'}' is not followed by whitespace.
'}' is not preceded with whitespace.
'typecast' is not followed by whitespace.
'try' is not followed by whitespace.
';' is preceded with whitespace.
2020-07-11 14:33:47 +05:30
Suraj Khurana 3bb22302c7 Improved: Corrected all checkstyle issues related to succeeding space for comma in framework directory.
(OFBIZ-11805)
Thanks Jacques and Ritesh Kumar for review.
2020-07-09 12:07:29 +05:30
Suraj Khurana fc6b8a6ca3 Improved: Corrected remaining ', is not followed by whitespace' checkstyle errors in framework component.
(OFBIZ-11805)
2020-07-07 15:08:17 +05:30
Suraj Khurana 4f53828bea Improved: Corrected all 'if is not followed by whitespace' checkstyle errors. Also corrected few ', is not followed by whitespace' checkstyle errors in framework component.
(OFBIZ-11805)
Thanks Jacques Le Roux and Ritesh Kumar for review.
2020-07-06 15:29:58 +05:30
Pawan Verma 3da16a182c Improved: Replace Collection.sort() with List.sort().(OFBIZ-11830) 2020-06-28 01:21:23 +05:30
Pawan Verma e19b12eae9 Improved: Replace explicit type argument with diamond operator(OFBIZ-11828)
Since Java 1.7, when defining generic types it is unnecessary to redefine those types in the constructor when it is already done in the declared type.
2020-06-28 01:04:51 +05:30
Pawan Verma 4275825b4a Improved: Replace anonymous types with lambda expressions(OFBIZ-11833) 2020-06-24 14:11:05 +05:30
Pawan Verma 2a4a617d0d Improved: Replace try-finally with try with resources(OFBIZ-11826)
Set checkstyleMain.maxErrors to 26678 (-4)

Thanks: Jacques for the review.
2020-06-22 21:32:42 +05:30
Pawan Verma 18f5dadd93 Improved: Replace single method call lambda with method reference(OFBIZ-11835)
Thanks: Jacques for the review.
2020-06-22 20:59:44 +05:30
Jacques Le Roux 488b9b6b9a Improved: Checks if the value passed to checkStringForHtmlSafe is not null (OFBIZ-11822)
This was reported by SpotBugs in Eclipse to prevent a possible NPE.

It seems to me that it's more complex than that because of the
PolicyFactory::sanitize methods signatures where @Nullable annotation is
used. So the SpotBugs warning remains, anyway can't hurt.

BTW found 92 issues reported by SpotBugs in Eclipse, among them 33 are "scary"

I had to add 1 to tasks.checkstyleMain.maxErrors because of
https://github.com/apache/ofbiz-framework/pull/203 that I pulled after the push
was rejected by the pre-push local Git hook
2020-06-16 14:05:16 +02:00
Jacques Le Roux df828419be Fixed: Double encoded urls are not being decoded (OFBIZ-11822)
This was broken by OFBIZ-10275

Thanks: Alex Bodnaru
2020-06-15 13:25:35 +02:00
Suraj Khurana 846e5f0ded Improved: Enforce noninstantiability to GroovyUtil Class. (#180)
(OFBIZ-11778)

Made class as final, moved default constructor and renamed private data members as per naming convention best practices.
2020-06-06 10:03:33 +05:30
Suraj Khurana abc7836dde Improved: Made MODULE as private data member of class instead of public in all framework components.
(OFBIZ-11739)
This will reduce checkstlye issues. Thanks Jacques for review.
2020-05-29 13:20:46 +05:30
Pawan Verma ba463ab9bc 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:21:11 +05:30
Jacques Le Roux d640a711d1 Improved: Prevent FreeMarker Template Injection (SSTI)
(OFBIZ-11709)

Better style with line not too long
2020-05-18 22:52:30 +02:00
Jacques Le Roux 09baa5537e Improved: Prevent FreeMarker Template Injection (SSTI)
(OFBIZ-11709)

Previous code compiled but SAFER_RESOLVER is not a class but a field, better KISS
2020-05-18 14:39:25 +02:00
Jacques Le Roux a6e8b05135 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
2020-05-18 12:06:28 +02:00
Jacques Le Roux e46c29962b 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:51:12 +02:00
Pawan Verma e925e5f1df 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:56:25 +05:30
Jacques Le Roux 3f60efb343 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:34:56 +02:00
Jacques Le Roux d0144d96e1 Improved: Increase the size of http.upload.max.sizethreshold
(OFBIZ-11598)

That's rather refactoring to avoid to have the size hardcoded in several places
Next: ask if it's OK for everyone to increase the size
2020-04-19 15:41:10 +02:00
Jacques Le Roux ddb8f4273a Improved: replaces module by MODULE everywhere 2020-04-05 19:46:34 +02:00
Jacques Le Roux e0f0d5271a Fixed: Prevent Host Header Injection (CVE-2019-12425)
(OFBIZ-11583)
2020-04-04 19:32:02 +02:00
Jacques Le Roux f4acda5ade 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 10:55:59 +01:00
Jacques Le Roux 369d5f6c95 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:50:17 +01:00
Michael Brohl 03b3a7bc02 Improved: Upgrade Freemarker from 2.3.29 to 2.3.30.
(OFBIZ-11445)
2020-03-08 01:13:05 +01:00
Jacques Le Roux 0e7d31912b 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
2020-02-24 11:00:51 +01:00
Michael Brohl 211c1924a5 Provide a FileItem entry in UtilHttp.getMultiPartParameterMap.
(OFBIZ-11346)
2020-02-22 11:57:11 +01:00
Jacques Le Roux 549543ace5 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:32:15 +01:00
Michael Brohl 3788f6766a Revert "Multi Part Input Parameters not Available in Groovy Event (OFBIZ-5048)"
This reverts commit 8af3e9ce6b.
2020-02-11 21:49:15 +01:00
Michael Brohl fc21237fee 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:10 +01:00
Nicolas Malin 30a389c8d9 Fixed: correct check style issue on ComponentContainerTest.java
No functionnal change
2020-02-06 13:29:26 +01:00