简体   繁体   English

typo3 sql注入保护

[英]typo3 sql injection protection

is there any sql injection protection in typo framework? 错字框架中有没有sql注入保护? Or I have to take care by myself of building a query? 或者我必须自己照顾构建查询?

I found prepare_SELECTqueryArray, but there is no example how it should look. 我找到了prepare_SELECTqueryArray,但没有示例它应该如何。 My TYPO3 version is 4.7. 我的TYPO3版本是4.7。 And this prepare_SELECTqueryArray I found on site with TYPO3 v.6.1. 这个prepare_SELECTqueryArray我在网站上找到了TYPO3 v.6.1。

Prepared Statements are available at least in TYPO3 4.5 as you can see here [1] and [2] 准备好的声明至少可以在TYPO3 4.5中找到,你可以在这里看到[1]和[2]

A Prepared query could look like this 准备好的查询可能如下所示

$preparedQuery = $this->link->prepare_SELECTquery('fieldblob,fieldblub', $table, 'id=:id', '', '', '', array(':id' => 1));
$preparedQuery->execute();
$result = $preparedQuery->fetch();

or 要么

$preparedQuery = $this->link->prepare_SELECTquery('fieldblob,fieldblub', $table, 'id=:id'); 
$preparedQuery->bindValues(array(':id' => 1));
$preparedQuery->execute();
$result = $preparedQuery->fetch();

[1] https://github.com/TYPO3/TYPO3.CMS/blob/TYPO3_4-5/t3lib/class.t3lib_db.php [1] https://github.com/TYPO3/TYPO3.CMS/blob/TYPO3_4-5/t3lib/class.t3lib_db.php

[2] https://github.com/TYPO3/TYPO3.CMS/blob/TYPO3_4-5/t3lib/db/class.t3lib_db_preparedstatement.php [2] https://github.com/TYPO3/TYPO3.CMS/blob/TYPO3_4-5/t3lib/db/class.t3lib_db_preparedstatement.php

On many places values are quoted automatically. 在许多地方,值会自动引用。 Within the prepare_* functions, all parameters are quoted by default. 在prepare_ *函数中,默认情况下引用所有参数。

If you use exec_* querys, you need to escape values in where part on your own. 如果使用exec_ * querys,则需要在自己的part部分中转义值。 Use $GLOBALS['TYPO3_DB']->fullQuoteStr($value, $tablename) for that. 使用$ GLOBALS ['TYPO3_DB'] - > fullQuoteStr($ value,$ tablename)。

Be aware, that you can create SQL-Injections with TypoScript too. 请注意,您也可以使用TypoScript创建SQL注入。 If you use CONTENT-Object you can insert GET/POST Data into the where-clause. 如果使用CONTENT-Object,则可以将GET / POST数据插入where子句。 Use intval or select.markers for creating SQL-Injection save querys. 使用intval或select.markers创建SQL-Injection保存查询。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM