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

fixed bug:mysql,delete from tableName where id =1,如果把where关键字写错了,如写成d… #1006

Closed
wants to merge 1 commit into from

Conversation

abirdman
Copy link
Contributor

…elete from tableName wher id =1,会导致整个表的数据被删除。update语句也有同样问题
对应的issue:#974

…elete from tableName wher id =1,会导致整个表的数据被删除。update语句也有同样问题
@wenshao
Copy link
Member

wenshao commented Dec 25, 2015

感觉这个不是bug

@magicdoom
Copy link
Contributor

遇到过几次druid解析出来没报错,实际丢掉了部分条件。
应该直接报错的

@XYUU
Copy link

XYUU commented Jan 27, 2016

如果这都不是bug,那世界上还有什么是bug?一句写错的sql导致把表内所有内容都删了还不是bug?

@Xiaobaxi
Copy link

程序本身就需要健壮性,防sql注入等

@magicdoom
Copy link
Contributor

这个不是用的数据源部分,是用的druid的sql解析部分,错误的sql解析不报错这个难道不是bug

@mfkvfn
Copy link

mfkvfn commented May 8, 2016

如果用了druid和不用druid,结果不一样,我觉得是druid的Bug。
如果用不用结果一样就不能怪druid了。

btw:那样的语句明显语法错误,mysql能直接执行不报错?

@gyk001
Copy link

gyk001 commented Jun 13, 2016

这种语句数据库本身会抛错吧 ?

@wenshao
Copy link
Member

wenshao commented Aug 5, 2016

怎么使用parser的?

@magicdoom
Copy link
Contributor

这个用的场景是数据库中间件里用来解析sql

@ZzzCrazyPig
Copy link
Contributor

ZzzCrazyPig commented Oct 14, 2016

druid parser作为mycat的解析器,如果遇到这种错误的语句,发往后端数据库实例将会直接删除掉整个表的数据,确实在druid parser的处理里面应该要识别出这种sql语法错误,上面的语句实际上将错写的where当成了表别名,然后druid parser将后面的条件直接过滤掉

@wangyu4882
Copy link

这种SQL在mysql中执行会报错的呀。怎么会执行成功呢?

@willenfoo
Copy link
Contributor

会导致全表更新, 这样的sql语句应该要被拦截的, 配置 deleteWhereNoneCheck=true, updateWhereNoneCheck=true, 危险SQL是不允许执行的

@aqnaruto
Copy link

aqnaruto commented Jan 31, 2018

这是什么数据库?mysql不会执行这种错误的执行语句。是druid parser将后面的条件直接过滤掉 导致的错误吧?
这种灾难性的bug还不是bug?

@majinding
Copy link

修复了吗?好慌啊

@CLAassistant
Copy link

CLAassistant commented Jun 28, 2019

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

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

Successfully merging this pull request may close these issues.