OSWAP ESAPI 的 Sybase 编解码器

Sybase codec for OSWAP ESAPI

我用的是sybase数据库

如果我想使用 OWASP ESAPI 来防止 SQL 注入

我应该使用哪个编解码器?

甲骨文编解码器? 我的SQL编解码器? DB2编解码器? https://static.javadoc.io/org.owasp.esapi/esapi/2.0.1/org/owasp/esapi/codecs/package-summary.html

谢谢!

首先,不要使用 ESAPI 来防止 SQL 注入。所有存在的 SQL 编码编解码器的设计意图是在网站被黑客攻击的事件中提供紧急措施,并且在重写所有查询以使用 Prepared Statements.

Here's an excerpt of documentation for the OracleCodec:

/**
 * Implementation of the Codec interface for Oracle strings. This function will only protect you from SQLi in the case of user data
 * bring placed within an Oracle quoted string such as:
 * 
 * select * from table where user_name='  USERDATA    ';

忽略 Sybase 手册中的以下语句:

不要准备只使用一次的语句

所有 数据库事务使用准备好的语句或存储过程。在将近十年的工程设计中,我从未真正看到过使用准备好的语句会导致现实生活中的性能损失。在大多数语言中,性能都会提高。 Java 肯定是这种情况。

预处理语句如下所示:

[2019 年编辑] 下面的代码在技术上可以是一个 SQLi 本身,当我写这篇文章时我的意思是指出 dbName 参数可以安全地以这种方式使用 only 当服务器对该值有绝对控制权时。[/2019]

String updateString =
    "update " + dbName + ".COFFEES " +
    "set SALES = ? where COF_NAME = ?";
updateSales = con.prepareStatement(updateString);

Here are more.

ESAPI目前没有提供Sybase编解码器,目前也没有开发的计划。

来源:我目前正在为 ESAPI 项目co-lead。