String safe = ESAPI.encoder().encodeForHTML( request.getParameter( "input" ) );
对用户输入“input”进行HTML编码,防止XSS。
使用ESAPI防止ORACLE数据库SQL注入的做法:
String sqlStr=“select name from tableA where id=”+
ESAPI.encoder().encodeForSQL(ORACLE_CODEC,validatedUserId)
+“and date_created”='“
+ ESAPI.encoder()。encodeForSQL(ORACLE_CODEC,validatedStartDate)+"'";
myStmt = conn.createStatement(sqlStr);
设置一个过滤器,在过滤器中对这两种情况就行处理
本文介绍如何利用OWASP ESAPI库对用户输入进行安全编码,以防范跨站脚本攻击(XSS)及SQL注入威胁。具体包括HTML编码防止XSS攻击的方法,以及针对ORACLE数据库的SQL注入防护措施。
395

被折叠的 条评论
为什么被折叠?



