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

[BUG] WallUtils针对union、验证疑似异常,包含MINUS、EXCEPT、INTERSECT #6339

Open
dev-GGBond opened this issue Jan 23, 2025 · 0 comments

Comments

@dev-GGBond
Copy link

Database Type

MySQL

Database Version

none

Druid Version

1.2.23以及旧版本1.2.16,其他版本未测试

JDK Version

jdk1.8

Error SQL

select * from t union select * from t2

Testcase Code

public class WallUnionTest extends TestCase {
private static final String UNION_SQL1 = "select f1, f2 from t where f1=1 union select 1, 2";
private static final String UNION_SQL2 = "select f1, f2 from t where f1=1 union select f1,f2 from t2 where id >10";
private static final String UNION_SQL3 = "select * from t union select * from t2";

public void testMySql() throws Exception {
    WallConfig config = new WallConfig();
    config.setSelectUnionCheck(true);
    System.out.println(WallUtils.isValidateMySql(UNION_SQL1, config));
    System.out.println(WallUtils.isValidateMySql(UNION_SQL2, config));
    System.out.println(WallUtils.isValidateMySql(UNION_SQL3, config));
}

}

Stacktrace Info

false
true
true

Error Info

union右侧带from则会检测异常,如:union select 1, 2则正常,select f1,f2 from t2 where id >10则异常,异常还包含其他拦截MINUS、EXCEPT、INTERSECT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant