2011-11-02 46 views
0

在一些CakePHP的應用程序,你可以找到另外這個 - >這裏安全性還有必要嗎?

preg_replace('/["\']/', '」', addslashes(strip_tags($thisHere))) 

http://noserub.googlecode.com/svn/branches/development/app/app_controller.php 其中$這個 - >控制器 - 這裏>以某種方式「額外擔保」

一)究竟是什麼/是問題用它?它會傷害應用程序嗎?我無法想象這個「或」會以任何方式傷害它

b)它仍然有用嗎?或者在所有更新的蛋糕版本中已經修復了所有「可能的危險」? 如果存在任何用例情況哪裏可以真正測試可能的問題?

注意:在2.0它已經移動到「$ this-> request-> here」 - 但仍包含當前的絕對url(/ controller/action/..)。

回答

0

我覺得有問題的線以上的評論是相當清楚的:

/** 
* Don't you EVER remove this line else you will make the whole 
* application a swiss cheese for XSS! 
* We often call echo $this->here in our form actions and this would 
* be exactly where the injection would take place. 
*/ 
$this->here = preg_replace('/("|\')/', 'â€', addslashes(strip_tags($this->here))); 
+0

我是假設,這種「修正」就已經實施很久以前,在蛋糕的核心。但我想不是每個人都在表單中使用$ this->然後...但這也意味着:沒有此修復程序的人使用它會自動產生一個不安全的應用程序。很不安! – mark