Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Hotfix] Fix arbitrary file readvulnerability on mysql cdc #167

Merged
merged 1 commit into from
Jun 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;

public class MysqlCDCDataSourceChannel implements DataSourceChannel {
Expand Down Expand Up @@ -154,13 +155,17 @@ protected Connection init(Map<String, String> requestParams) throws SQLException
throw new DataSourcePluginException("Jdbc url is null");
}
String url = requestParams.get(MysqlCDCOptionRule.BASE_URL.key());

Properties info = new java.util.Properties();
info.put("autoDeserialize", "false");
info.put("allowLoadLocalInfile", "false");
info.put("allowLoadLocalInfileInPath", "");
if (null != requestParams.get(MysqlCDCOptionRule.PASSWORD.key())
&& null != requestParams.get(MysqlCDCOptionRule.USERNAME.key())) {
String username = requestParams.get(MysqlCDCOptionRule.USERNAME.key());
String password = requestParams.get(MysqlCDCOptionRule.PASSWORD.key());
return DriverManager.getConnection(url, username, password);
info.put("user", requestParams.get(MysqlCDCOptionRule.USERNAME.key()));
info.put("password", requestParams.get(MysqlCDCOptionRule.PASSWORD.key()));
}
return DriverManager.getConnection(url);
return DriverManager.getConnection(url, info);
}

protected List<String> getDataBaseNames(Map<String, String> requestParams) throws SQLException {
Expand Down
Loading