Package com.alibaba.druid.wall.spi

Examples of com.alibaba.druid.wall.spi.MySqlWallProvider


* @see
*/
public class MySqlWallTest84 extends TestCase {

    public void test_false() throws Exception {
        WallProvider provider = new MySqlWallProvider();
       
        Assert.assertTrue(provider.checkValid(//
        "CREATE INDEX part_of_name ON customer (name(10));"));

        Assert.assertEquals(1, provider.getTableStats().size());
    }
View Full Code Here


import com.alibaba.druid.wall.spi.MySqlWallProvider;

public class MySqlWallTest121 extends TestCase {

    public void test_false() throws Exception {
        WallProvider provider = new MySqlWallProvider();
        provider.getConfig().setCommentAllow(false);

        String sql = "SELECT name, '******' password, createTime from user where name like 'admin%' AND (SELECT 6384 FROM(SELECT COUNT(*),CONCAT(0x3a64686c3a,(SELECT (CASE WHEN (3252 = 3252) THEN 1 ELSE 0 END)),0x3a766f723a,FLOOR(RAND(0)*2))x FROM INFORMATION_SCHEMA.CHARACTER_SETS GROUP BY x)a) AND '%'=''";

        Assert.assertFalse(provider.checkValid(sql));
    }
View Full Code Here

* @see
*/
public class MySqlWallTest76 extends TestCase {

    public void test_false() throws Exception {
        WallProvider provider = new MySqlWallProvider();
       
        Assert.assertFalse(provider.checkValid(//
        "SELECT * FROM T WHERE FID = ? OR GREATEST(2,0) = 2"));

        Assert.assertEquals(1, provider.getTableStats().size());
    }
View Full Code Here

import com.alibaba.druid.wall.spi.MySqlWallProvider;

public class MySqlWallTest102 extends TestCase {

    public void test_false() throws Exception {
        WallProvider provider = new MySqlWallProvider();
        provider.getConfig().setCommentAllow(false);

        String sql = "select * from t where id = ? or substr(bin(97>>5), -1, 1)";

        Assert.assertFalse(provider.checkValid(sql));
    }
View Full Code Here

* @see
*/
public class MySqlWallTest69 extends TestCase {

    public void test_true() throws Exception {
        WallProvider provider = new MySqlWallProvider();
        provider.getConfig().setCommentAllow(true);

        Assert.assertTrue(provider.checkValid(//
        "select * from T--"));

        Assert.assertEquals(1, provider.getTableStats().size());
    }
View Full Code Here

import com.alibaba.druid.wall.spi.MySqlWallProvider;

public class MySqlWallTest131 extends TestCase {

    public void test_false() throws Exception {
        WallProvider provider = new MySqlWallProvider();
        provider.getConfig().setCommentAllow(true);
       
        Assert.assertFalse(provider.checkValid("select * from t where id = 1 /*!30000union all select 2*/"));
    }
View Full Code Here

* @see
*/
public class MySqlWallTest_ifnull_2 extends TestCase {

    public void test_false() throws Exception {
        WallProvider provider = new MySqlWallProvider();
       
        Assert.assertFalse(provider.checkValid(//
        "SELECT * FROM T WHERE FID = ? OR IFNULL(CAST(CURRENT_USER() AS CHAR))"));

        Assert.assertEquals(1, provider.getTableStats().size());
    }
View Full Code Here

    protected void tearDown() throws Exception {
        WallContext.clearContext();
    }

    public void testMySql() throws Exception {
        WallProvider provider = new MySqlWallProvider();
        provider.getConfig().setDropTableAllow(true);

        Assert.assertTrue(provider.checkValid(sql));
        WallTableStat tableStat = provider.getTableStat("t");
        Assert.assertEquals(1, tableStat.getDropCount());
    }
View Full Code Here

* @see
*/
public class MySqlWallTest88 extends TestCase {

    public void test_false() throws Exception {
        WallProvider provider = new MySqlWallProvider();
       
        Assert.assertTrue(provider.checkValid(//
        "DROP INDEX `PRIMARY` ON t;"));

        Assert.assertEquals(1, provider.getTableStats().size());
        Assert.assertTrue(provider.getTableStats().containsKey("t"));
    }
View Full Code Here

import com.alibaba.druid.wall.spi.MySqlWallProvider;

public class MySqlWallTest106 extends TestCase {

    public void test_false() throws Exception {
        WallProvider provider = new MySqlWallProvider();
        provider.getConfig().setCommentAllow(false);

        String sql = "select * from t where id = ? or bin(1) = 1";

        Assert.assertFalse(provider.checkValid(sql));
    }
View Full Code Here

TOP

Related Classes of com.alibaba.druid.wall.spi.MySqlWallProvider

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.