Restrict effect of setGrant() to current request

앞으로 또 발견될지도 모르는 보안 취약점으로 인한 피해를 줄이기 위해
문서나 댓글에 대하여 setGrant()를 호출하더라도 해당 세션 전체가 아닌
하나의 요청 내에서만 관리권한을 부여받도록 고칩니다.

세션 전체에 관리 권한을 부여하려면 새로 추가된 setGrantForSession()
메소드를 사용하여야 하며, 이것은 함부로 사용해서는 안됩니다.

그동안 getDocument(), getComment() 등에 $is_admin 파라미터가 너무
남용되어 왔으므로, 이 권한을 제한하는 것만으로도 서드파티 호환성에
미치는 영향을 최소화하면서 상당한 효과가 있을 것으로 보입니다.
This commit is contained in:
Kijin Sung 2017-03-02 20:41:36 +09:00
parent 9615d85d81
commit 238d97e4ab
3 changed files with 14 additions and 4 deletions

View file

@ -609,7 +609,7 @@ class boardController extends board
return new Object(-1, 'msg_invalid_password');
}
$oComment->setGrant();
$oComment->setGrantForSession();
} else {
// get the document information
$oDocumentModel = getModel('document');
@ -625,7 +625,7 @@ class boardController extends board
return new Object(-1, 'msg_invalid_password');
}
$oDocument->setGrant();
$oDocument->setGrantForSession();
}
}

View file

@ -125,10 +125,15 @@ class commentItem extends Object
function setGrant()
{
$_SESSION['own_comment'][$this->comment_srl] = TRUE;
$this->is_granted = TRUE;
}
function setGrantForSession()
{
$_SESSION['own_comment'][$this->comment_srl] = true;
$this->setGrant();
}
function setAccessible()
{
if(Context::getSessionStatus())

View file

@ -198,9 +198,14 @@ class documentItem extends Object
function setGrant()
{
$_SESSION['own_document'][$this->document_srl] = true;
$this->grant_cache = true;
}
function setGrantForSession()
{
$_SESSION['own_document'][$this->document_srl] = true;
$this->setGrant();
}
function isAccessible()
{