解决禅道不登录也可以通过url直接访问需求、任务、bug里的图片等文件,防止别人通过猜测文件后缀名来访问上传的文件,比如下图这样的URL:
在禅道里,默认是可以通过直接输入URL的方式访问的,对于安全性要求比较高的场合,是一个比较明显得隐患!
解决办法:
修改这个文件: vi /opt/zbox/app/zentao/module/common/model.php
按照下图修改:
```java
/**
* Juage a method of one module is open or not?
*
* @param string $module
* @param string $method
* @access public
* @return bool
*/
public function isOpenMethod($module, $method)
{
if(in_array("$module.$method", $this->config->openMethods)) return true;
if($module == 'block' and $method == 'main' and isset($_GET['hash'])) return true;
if($this->loadModel('user')->isLogon() or ($this->app->company->guest and $this->app->user->account == 'guest'))
{
if($module == 'file' and $method == 'read') return true;
if(stripos($method, 'ajax') !== false) return true;
if($module == 'block') return true;
if($module == 'my' and $method == 'guidechangetheme') return true;
if($module == 'misc' and $method == 'downloadclient') return true;
if($module == 'misc' and $method == 'changelog') return true;
if($module == 'tutorial' and $method == 'start') return true;
if($module == 'tutorial' and $method == 'index') return true;
if($module == 'tutorial' and $method == 'quit') return true;
if($module == 'tutorial' and $method == 'wizard') return true;
if($module == 'product' and $method == 'showerrornone') return true;
}
return false;
}
此行是加入的: if($module == 'file' and $method == 'read') return true;
修改完成后重启Apache,即可实现直接输入URL访问禅道下的文件都会自动跳转到登陆页面(如果没登陆的话)