RBAC (역할 기반 액세스 제어)의 BizRules 개념은 나를 아프게합니다. 기본적으로 권한 부여 중에 데이터에 대해 실행할 스크립트를 정의하는 방법입니다. 예를 들어RBAC의 BizRules (비즈니스 규칙)은 실제로 안전합니까?
는 YII 프레임 워크를 지원합니다 http://www.yiiframework.com/doc/api/1.1/CAuthManager#createRole-detail
여기 public CAuthItem createRole(string $name, string $description='', string $bizRule=NULL, mixed $data=NULL)
비즈니스 규칙 실행하기위한 소스 코드이다 : 그래서
/**
* Executes the specified business rule.
* @param string $bizRule the business rule to be executed.
* @param array $params parameters passed to {@link IAuthManager::checkAccess}.
* @param mixed $data additional data associated with the authorization item or assignment.
* @return boolean whether the business rule returns true.
* If the business rule is empty, it will still return true.
*/
public function executeBizRule($bizRule,$params,$data)
{
return $bizRule==='' || $bizRule===null || ($this->showErrors ? eval($bizRule)!=0 : @eval($bizRule)!=0);
}
을, 당신은 같은 일을 수행 할 수 있습니다
// Assume this bizRule: $bizRule='return Yii::app()->user->id==$params["post"]->authID;';
Yii::app()->user->checkAccess('createUser', array('post' => $post));
기본적으로 컨텍스트에서 지정된 배열에 $ params를 설정하는 규칙입니다.
저는 보안 측면에서 비즈니스 규칙을 좋아하지 않습니다. 그것을하는 더 좋은 방법이 있습니까?
를 사용할 수 있다고 생각, 사람을 도움이 될 것입니다? – AviD
사실 [약간 관련있는 질문] (http://security.stackexchange.com/q/346/33)을 확인하십시오. – AviD