当前位置:网站首页>mysql advanced (twenty-four) method summary of defense against SQL injection
mysql advanced (twenty-four) method summary of defense against SQL injection
2022-08-03 11:40:00 【InfoQ】
一、前言
二、Demonstrate the classicSQL注入

select id,no from user where id=2;String sql = "select id,no from user where id=" + id;select id,no from user where id=2 or 1=1;
三、sql注入的原因
String sql = "select id,no from user where id=" + id; or 1=1 where id= 四、sql注入的防御
String sql = "select id, no from user where id=?";
PreparedStatement ps = conn.prepareStatement(sql);
ps.setInt(1, id);
ps.executeQuery();PreparedStatementselect id, no from user where id=? select ,from ,where ,and, or ,order by String sql = "select id,no from user where id=" + id; MySQLCodec codec = new MySQLCodec(Mode.STANDARD);
name = ESAPI.encoder().encodeForSQL(codec, name);
String sql = "select id,no from user where name=" + name;
ESAPI.encoder().encodeForSQL(codec, name)五、总结
ibatis,mybatis,hibernateibatis/mybatis#{name}${name}边栏推荐
- 浅谈SVN备份
- FR9811S6 SOT-23-6 23V,2A同步降压DC/DC转换器
- 最牛逼的集群监控系统,它始终位列第一!
- Objective - C code analysis of the deep and shallow copy
- [Output each bit of an integer, from high to low.With and without recursion]
- 【TypeScript】Why choose TypeScript?
- This article takes you to understand the principle of CDN technology
- Matlab学习11-图像处理之图像变换
- 【一起学Rust】Rust学习前准备——注释和格式化输出
- LeetCode刷题笔记:105.从前序与中序遍历序列构造二叉树
猜你喜欢

OFDM 十六讲 4 -What is a Cyclic Prefix in OFDM

微信小程序获取用户手机号码

MySQL database combat (1)

Fastjson反序列化

Skills required to be a good architect: How to draw a system architecture that everyone will love?What's the secret?Come and open this article to see it!...

Lease recovery system based on PHP7.2+MySQL5.7
![[Detailed explanation of binary search plus recursive writing method] with all the code](/img/51/c4960575a59f8ca7f161b310e47b27.png)
[Detailed explanation of binary search plus recursive writing method] with all the code

第四周学习 HybridSN,MobileNet V1,V2,V3,SENet

零拷贝、MMAP、堆外内存,傻傻搞不明白...

SmobilerService 推送实现
随机推荐
Polymorphism in detail (simple implementation to buy tickets system simulation, covering/weight definition, principle of polymorphism, virtual table)
国内数字藏品与国外NFT主要有以下六大方面的区别
后台图库上传功能
bash for循环
Matlab学习11-图像处理之图像变换
实现2d人物在跳跃的同时左右移动
SmobilerService 推送实现
【TypeScript】Why choose TypeScript?
fast planner中拓扑路径搜索
第四课 标识符、关键字、变量、变量的分类和作用域、常量
【MySQL】数据库进阶之索引内容详解(上篇 索引分类与操作)
基于Sikuli GUI图像识别框架的PC客户端自动化测试实践
ABAB-740新语法
【JDBC以及内部类的讲解】
LeetCode-142. 环形链表 II
基于Sikuli GUI图像识别框架的PC客户端自动化测试实践
通过组策略安装软件和删除用户配置文件
Cookie和Session使用
GET 和 POST 有什么区别?
基于PHP7.2+MySQL5.7的回收租凭系统