0
我有一個控制器功能,其權限設置爲ADMIN,需要從cron作業執行,不幸地從php或php-cgi調用它,表示控制器上不允許actipn。我已經暫時取消了ADMIN檢查,但它是資源密集型所以這是一個可能的DDOS矢量Silverstripe Cron Job Admin操作
我有一個控制器功能,其權限設置爲ADMIN,需要從cron作業執行,不幸地從php或php-cgi調用它,表示控制器上不允許actipn。我已經暫時取消了ADMIN檢查,但它是資源密集型所以這是一個可能的DDOS矢量Silverstripe Cron Job Admin操作
您可以使用自定義權限檢查在控制器檢查,如果呼叫從CLI所做的:
class FooController extends Controller {
private static $allowed_actions = array(
'mySecureAction' => '->MySecurityCheck'
);
public function mySecureAction() {
// do something here
}
/**
* if this method returns true, the action will be executed
* for more information, view the docs at: http://doc.silverstripe.org/framework/en/topics/controller#access-control
*/
public function MySecurityCheck() {
return Director::is_cli() || Permission::check('ADMIN');
}
}