(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.
(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
(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
(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.
(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.
(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.
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
(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.
(OFBIZ-10198)
This patch extends the current UtilHttp.urlEncodeArgs() method with an
additional input parameter: boolean preserveEmpty.
It allows to get a query string with empty parameters, useful if the
receiver expects mandatory parameters or wants to explicit
override/clear existing values with an empty one.
Thanks Martin Becker for reporting and providing the patch.
(OFBIZ-11331)
Running ComponentContainerTest on windows fails due to parsing of paths of the
form '/c:/dev/....'
org.apache.ofbiz.base.container.ComponentContainerTest >
testCheckDependencyForComponent FAILED
java.nio.file.InvalidPathException at ComponentContainerTest.java:44
Line 44:
private Path ofbizHome = Paths.get(ComponentContainerTest.class.getResource
("testsdata").getFile()).toAbsolutePath().normalize();
PR created: #8
Thanks: Daniel WatfordNina Simone - My Baby Just Cares For Me.mp3
Those directories are already added in the classpath by the build
system. The classpath info defined in “ofbiz-component.xml” files are
now only used to retrieve label files.
(OFBIZ-11161)
All files in {compoment}/config directories are placed in jar
root (cf. sourceSets definition in build.gradle) but there are 4 different
`freemarkerTransforms.properties` in ofbiz (content, product, webapp, widget).
This works fine because we are adding config directories in classpath (through
classpath tag in ofbiz-component.xml), but this is not really intuitive. So to
make things clearer this patch move `freemarkerTransforms.properties` into
`src/main/resources` with a namespace package and `FreeMarkerWorker.java` is
modified accordingly.
(OFBIZ-11275)
This fixes a bug identified by ‘testCheckDependencyForComponent’ where
the dependencies declared inside component configurations were not
impacting the component retrieval order.
Component configurations stored in the cache can now be properly
sorted based on their <depends-on> declaration. The new
‘ComponentConfig#sortDependencies’ method returns a collection of
component configuration following a topological ordering.
In case of dependency cycle we throw an error.
(OFBIZ-11281)
StringUtil#strToMap(String, String, boolean, String) throws Nullpointer for StringUtil.strToMap("", false).
Thanks to Ulrich Heidfeld for this fix
(OFBIZ-11275)
This fixes a bug identified by ‘testCheckDependencyForComponent’ where
the dependencies declared inside component configurations were not
impacting the component retrieval order.
Component configurations stored in the cache can now be properly
sorted based on their <depends-on> declaration. The new
‘ComponentConfig#sortDependencies’ method returns a collection of
component configuration following a topological ordering.
In case of dependency cycle we throw an error.
(OFBIZ-11275)
This adds a test demonstrating a bug in the dependency resolution
algorithm done in ‘ComponentContainer’.
When relying on <depends-on> declaration in “ofbiz-component.xml”
files we should expect to retrieve components (and their associated
containers) in a topological ordering meaning a linear ordering where
each component configuration element is placed after its dependencies
configuration elements. Currently this is not the case and the
dependency declarations only impact the construction of the dynamic
classpath.
(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
(OFBIZ-11264)
`depends-on` XML tag doesn't have any `loader` or `location` attribute so
DependsOnInfo does not need to extend ResourceInfo.
When removing the class derivation, DependsOnInfo now becomes a simple box
containing a String attribute. In order to make the manipulation of dependency
information simpler, the attribute is now inlined as a simple String value.
Thanks: Samuel Trégouët for your contribution
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1869185 13f79535-47bb-0310-9956-ffa450edef68
(OFBIZ-11264)
The list of component classpath elements was constructed iteratively
while loading components. This list was additionally used to check if
a component was actually loaded. This implementation was leading to
hard to understand code that has been replaced by a more appropriate
‘LinkedHashSet’ object.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1869182 13f79535-47bb-0310-9956-ffa450edef68