Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Security hardening #685

Open
wants to merge 1 commit into
base: support/2.7
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1228,6 +1228,8 @@ public function GetInformationAsJsonAction(Request $oRequest)
$oRequestManipulator = $this->get('request_manipulator');
/** @var \Combodo\iTop\Portal\Helper\ScopeValidatorHelper $oScopeValidator */
$oScopeValidator = $this->get('scope_validator');
/** @var \Combodo\iTop\Portal\Helper\SecurityHelper $oSecurityHelper */
$oSecurityHelper = $this->get('security_helper');

$aData = array();

Expand All @@ -1246,7 +1248,8 @@ public function GetInformationAsJsonAction(Request $oRequest)
$bIgnoreSilos = $oScopeValidator->IsAllDataAllowedForScope(UserRights::ListProfiles(), $sObjectClass);
$aParams = array('objects_id' => $aObjectIds);
$oSearch = DBObjectSearch::FromOQL("SELECT $sObjectClass WHERE id IN (:objects_id)");
if ($bIgnoreSilos === true)
$oScopeValidator->AddScopeToQuery($oSearch, $sObjectClass);
if ($bIgnoreSilos === true)
{
$oSearch->AllowAllData();
}
Expand All @@ -1263,6 +1266,12 @@ public function GetInformationAsJsonAction(Request $oRequest)
// Retrieving objects
while ($oObject = $oSet->Fetch())
{
$sObjectId = $oObject->Get('id');
if (!$oSecurityHelper->IsActionAllowed(UR_ACTION_READ, $sObjectClass, $sObjectId))
{
IssueLog::Warning(__METHOD__.' at line '.__LINE__.' : User #'.UserRights::GetUserId().' not allowed to read '.$sObjectClass.'::'.$sObjectId.' object.');
jf-cbd marked this conversation as resolved.
Show resolved Hide resolved
throw new HttpException(Response::HTTP_NOT_FOUND, Dict::S('UI:ObjectDoesNotExist'));
}
$aData['items'][] = $this->PrepareObjectInformation($oObject, $aObjectAttCodes);
}

Expand Down