Skip to content

Commit c9e38aa

Browse files
security: fix mysql jdbc deserialization security vulnerability (#912)
Co-authored-by: IL MARE <yh263208@oceanbase.com>
1 parent 309f461 commit c9e38aa

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

server/odc-service/src/main/java/com/oceanbase/odc/service/session/factory/DruidDataSourceFactory.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ private void init(DruidDataSource dataSource) {
9292
properties.setProperty("allowLoadLocalInfile", "false");
9393
properties.setProperty("allowUrlInLocalInfile", "false");
9494
properties.setProperty("allowLoadLocalInfileInPath", "");
95+
properties.setProperty("autoDeserialize", "false");
9596
dataSource.setConnectProperties(properties);
9697
try {
9798
setConnectAndSocketTimeoutFromJdbcUrl(dataSource);

server/odc-service/src/main/java/com/oceanbase/odc/service/session/factory/OBConsoleDataSourceFactory.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,8 @@ public static Map<String, String> getJdbcParams(@NonNull ConnectionConfig connec
180180
// fix arbitrary file reading vulnerability
181181
jdbcUrlParams.put("allowLoadLocalInfile", "false");
182182
jdbcUrlParams.put("allowUrlInLocalInfile", "false");
183+
jdbcUrlParams.put("allowLoadLocalInfileInPath", "");
184+
jdbcUrlParams.put("autoDeserialize", "false");
183185
return jdbcUrlParams;
184186
}
185187

@@ -198,6 +200,7 @@ public DataSource getDataSource() {
198200
properties.setProperty("allowLoadLocalInfile", "false");
199201
properties.setProperty("allowUrlInLocalInfile", "false");
200202
properties.setProperty("allowLoadLocalInfileInPath", "");
203+
properties.setProperty("autoDeserialize", "false");
201204
dataSource.setConnectionProperties(properties);
202205
if (autoCommit != null) {
203206
dataSource.setAutoCommit(autoCommit);

server/plugins/connect-plugin-mysql/src/main/java/com/oceanbase/odc/plugin/connect/mysql/MySQLConnectionExtension.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ public TestResult test(String jdbcUrl, String username, String password, int que
7171
properties.setProperty("allowLoadLocalInfile", "false");
7272
properties.setProperty("allowUrlInLocalInfile", "false");
7373
properties.setProperty("allowLoadLocalInfileInPath", "");
74+
properties.setProperty("autoDeserialize", "false");
7475
TestResult testResult = test(jdbcUrl, properties, queryTimeout);
7576
if (testResult.getErrorCode() != null) {
7677
return testResult;

0 commit comments

Comments
 (0)