Skip to content

Commit

Permalink
security: FAQ Manage Permissions
Browse files Browse the repository at this point in the history
This addresses a vulnerability reported by @lujiefsi where Agents can
potentially bypass the FAQ restrictions.
  • Loading branch information
JediKev committed Oct 25, 2023
1 parent 45d7030 commit 04f4e61
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions scp/faq.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,11 @@
$attachments->setAttachments($faq->getAttachments($lang)->window(array('inline' => false)));
}
}
// Check if the Staff can Manage FAQs
$can_manage = $thisstaff->hasPerm(FAQ::PERM_MANAGE);

if ($_POST) {
// Make sure the Agent has permission
if ($_POST && $can_manage) {
$errors=array();
// General attachments
$_POST['files'] = $faq_form->getField('attachments')->getClean();
Expand Down Expand Up @@ -142,20 +145,19 @@
break;
default:
$errors['err']=__('Unknown action');

}
}

$inc='faq-categories.inc.php'; //FAQs landing page.
if($faq && $faq->getId()) {
$inc='faq-view.inc.php';
if ($_REQUEST['a']=='edit'
&& $thisstaff->hasPerm(FAQ::PERM_MANAGE))
&& $can_manage)
$inc='faq.inc.php';
elseif ($_REQUEST['a'] == 'print')
return $faq->printPdf();
}elseif($_REQUEST['a']=='add'
&& $thisstaff->hasPerm(FAQ::PERM_MANAGE)) {
&& $can_manage) {
$inc='faq.inc.php';
} elseif($category && $_REQUEST['a']!='search') {
$inc='faq-category.inc.php';
Expand Down

0 comments on commit 04f4e61

Please sign in to comment.