mirror of https://github.com/MISP/MISP
fix: [upload_stix] Fixed the `distribution` & `sharing_group_id` values checking
- we have to convert them to int to check with the list of distributions and sharing groups that have int keyspull/9044/head
parent
a1b36cfb9c
commit
50c7b930f6
|
@ -2388,8 +2388,9 @@ class EventsController extends AppController
|
|||
$publish = $this->params['named']['publish'];
|
||||
}
|
||||
if (isset($this->params['named']['distribution'])) {
|
||||
if (in_array($this->params['named']['distribution'], $distributionLevels)) {
|
||||
$initialDistribution = $this->params['named']['distribution'];
|
||||
$distribution = intval($this->params['named']['distribution']);
|
||||
if (in_array($distribution, $distributionLevels)) {
|
||||
$initialDistribution = $distribution;
|
||||
} else {
|
||||
throw new MethodNotAllowedException(__('Wrong distribution level'));
|
||||
}
|
||||
|
@ -2399,7 +2400,7 @@ class EventsController extends AppController
|
|||
if (!isset($this->params['named']['sharing_group_id'])) {
|
||||
throw new MethodNotAllowedException(__('The sharing group id is needed when the distribution is set to 4 ("Sharing group").'));
|
||||
}
|
||||
$sharingGroupId = $this->params['named']['sharing_group_id'];
|
||||
$sharingGroupId = intval($this->params['named']['sharing_group_id']);
|
||||
if (!in_array($sharingGroupId, $sgs)) {
|
||||
throw new MethodNotAllowedException(__('Please select a valid sharing group id.'));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue