mirror of
https://github.com/corda/corda.git
synced 2024-12-28 08:48:57 +00:00
Enable deserialisation for certain package from Oracle database drivers. (#298)
* Oracle database drivers ojdbc7.jar and ojdbc8.jar use deserialisation which is disabled by the default in Corda. Added an Oracle package to serialFilter when the node uses Oracle database.
This commit is contained in:
parent
40edc286f5
commit
c7487a8696
@ -173,4 +173,7 @@ class HibernateConfiguration(
|
||||
return "corda-wrapper-binary"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Allow Oracle database drivers ojdbc7.jar and ojdbc8.jar to deserialize classes from oracle.sql.converter package. */
|
||||
fun oracleJdbcDriverSerialFilter(clazz: Class<*>) : Boolean = clazz.name.startsWith("oracle.sql.converter.")
|
||||
|
@ -13,6 +13,7 @@ import net.corda.node.shell.InteractiveShell
|
||||
import net.corda.node.utilities.registration.HTTPNetworkRegistrationService
|
||||
import net.corda.node.utilities.registration.NetworkRegistrationHelper
|
||||
import net.corda.nodeapi.internal.addShutdownHook
|
||||
import net.corda.nodeapi.internal.persistence.oracleJdbcDriverSerialFilter
|
||||
import org.fusesource.jansi.Ansi
|
||||
import org.fusesource.jansi.AnsiConsole
|
||||
import org.slf4j.bridge.SLF4JBridgeHandler
|
||||
@ -201,7 +202,19 @@ open class NodeStartup(val args: Array<String>) {
|
||||
open protected fun loadConfigFile(cmdlineOptions: CmdLineOptions): NodeConfiguration = cmdlineOptions.loadConfig()
|
||||
|
||||
open protected fun banJavaSerialisation(conf: NodeConfiguration) {
|
||||
SerialFilter.install(if (conf.notary?.bftSMaRt != null) ::bftSMaRtSerialFilter else ::defaultSerialFilter)
|
||||
val isOracleDbDriver = conf.dataSourceProperties.getProperty("dataSource.url", "").startsWith("jdbc:oracle:")
|
||||
val filter =
|
||||
if (conf.notary?.bftSMaRt != null && isOracleDbDriver) {
|
||||
val bftAndOracleSerialFilter: (Class<*>) -> Boolean = { clazz -> bftSMaRtSerialFilter(clazz) || oracleJdbcDriverSerialFilter(clazz) }
|
||||
bftAndOracleSerialFilter
|
||||
} else if (conf.notary?.bftSMaRt != null) {
|
||||
::bftSMaRtSerialFilter
|
||||
} else if (isOracleDbDriver) {
|
||||
::oracleJdbcDriverSerialFilter
|
||||
} else {
|
||||
::defaultSerialFilter
|
||||
}
|
||||
SerialFilter.install(filter)
|
||||
}
|
||||
|
||||
open protected fun getVersionInfo(): VersionInfo {
|
||||
|
Loading…
Reference in New Issue
Block a user