Improved: Prevent possible DOS attack done using Java deserialisation (OFBIZ-12592)

The previous commit was twice wrong:
1. System properties in gradle.properties are not defined using -D but using
systemProp.
2. Anyway systemProp. is defining system properties only available in JVM where
Gradle is running, not the application you run. For that you need to use
applicationDefaultJvmArgs in application in the main build.gradle.

Here is the system property for jdk.serialFilter
This commit is contained in:
Jacques Le Roux
2022-04-21 05:59:48 +02:00
parent 3de52be907
commit 389f90cbb6
2 changed files with 3 additions and 5 deletions
+3 -3
View File
@@ -80,9 +80,10 @@ ext.pluginsDir = "${rootDir}/plugins"
application {
mainClassName = 'org.apache.ofbiz.base.start.Start'
// jdk.serialFilter is to "Prevent possible DOS attack done using Java deserialisation" (OFBIZ-12592)
applicationDefaultJvmArgs = project.hasProperty('jvmArgs')
? jvmArgs.tokenize()
: ['-Xms128M', '-Xmx1024M']
: ['-Xms128M','-Xmx1024M','-Djdk.serialFilter=maxarray=100000;maxdepth=20;maxrefs=500;maxbytes=500000']
}
distributions.main.contents.from(rootDir) {
@@ -1148,7 +1149,6 @@ tasks.startScripts {
unixScript.text.replace('CLASSPATH=$APP_HOME/lib','CLASSPATH=$APP_HOME/config/:$APP_HOME/lib-extra/*:$APP_HOME/lib')
// Alter the start script for Windows systems.
windowsScript.text =
windowsScript.text.replace('CLASSPATH=%APP_HOME%\\lib',
'CLASSPATH=%APP_HOME%\\conf\\;%APP_HOME%\\lib-extra\\*;%APP_HOME%\\lib')
windowsScript.text.replace('CLASSPATH=%APP_HOME%\\lib','CLASSPATH=%APP_HOME%\\conf\\;%APP_HOME%\\lib-extra\\*;%APP_HOME%\\lib')
}
}
-2
View File
@@ -21,5 +21,3 @@ org.gradle.console=plain
# If you experience heap memory problems during the Gradle build, for example
# building with integrated plugins, the following setting might help
#org.gradle.jvmargs=-Xms128m -Xmx1024m -XX:+CMSClassUnloadingEnabled
# This is for "Prevent possible DOS attack done using Java deserialisation" (OFBIZ-12592)
-Djdk.serialFilter=maxarray=100000;maxdepth=20;maxrefs=500;maxbytes=500000