fix: 校验 redshift database name

This commit is contained in:
taojinlong 2023-03-08 17:14:26 +08:00
parent d9a32cb40f
commit 461eb1ee6e

View File

@ -777,6 +777,14 @@ public class JdbcProvider extends DefaultJdbcProvider {
case StarRocks:
MysqlConfiguration mysqlConfiguration = new Gson().fromJson(datasource.getConfiguration(), MysqlConfiguration.class);
mysqlConfiguration.getJdbc();
case redshift:
RedshiftConfiguration redshiftConfiguration = new Gson().fromJson(datasource.getConfiguration(), RedshiftConfiguration.class);
if(redshiftConfiguration.getDataBase().length() > 64 || redshiftConfiguration.getDataBase().length() < 1){
throw new Exception("Invalid database name");
}
if(!redshiftConfiguration.getDataBase().matches("\"^[a-z][a-z0-9_+.@-]*$\"")){
throw new Exception("Invalid database name");
}
default:
break;
}