mirror of https://github.com/MISP/MISP
Merge branch 'develop' into 2.4
commit
d1e661ffe0
2
PyMISP
2
PyMISP
|
@ -1 +1 @@
|
|||
Subproject commit 156f6d9083a83f8af8968eaf54d6f4d64e5a4395
|
||||
Subproject commit b1892efb6a078d1370cee51c9103f3a591c628d2
|
|
@ -1 +1 @@
|
|||
{"major":2, "minor":4, "hotfix":156}
|
||||
{"major":2, "minor":4, "hotfix":157}
|
||||
|
|
|
@ -35,7 +35,7 @@ class AppController extends Controller
|
|||
public $helpers = array('OrgImg', 'FontAwesome', 'UserName');
|
||||
|
||||
private $__queryVersion = '137';
|
||||
public $pyMispVersion = '2.4.155';
|
||||
public $pyMispVersion = '2.4.157';
|
||||
public $phpmin = '7.2';
|
||||
public $phprec = '7.4';
|
||||
public $phptoonew = '8.0';
|
||||
|
|
|
@ -1,18 +1,16 @@
|
|||
<?php
|
||||
App::uses('AppController', 'Controller');
|
||||
|
||||
/**
|
||||
* @property CryptographicKey $CryptographicKey
|
||||
*/
|
||||
class CryptographicKeysController extends AppController
|
||||
{
|
||||
public $components = array('Session', 'RequestHandler');
|
||||
|
||||
public function beforeFilter()
|
||||
{
|
||||
parent::beforeFilter();
|
||||
}
|
||||
|
||||
public $paginate = array(
|
||||
'limit' => 60,
|
||||
'maxLimit' => 9999
|
||||
'limit' => 60,
|
||||
'maxLimit' => 9999
|
||||
);
|
||||
|
||||
public function add($type, $parent_id)
|
||||
|
|
|
@ -94,7 +94,7 @@ class BackgroundJobsTool
|
|||
|
||||
/**
|
||||
* Initialize
|
||||
*
|
||||
*
|
||||
* Settings should have the following format:
|
||||
* [
|
||||
* 'enabled' => true,
|
||||
|
@ -111,6 +111,7 @@ class BackgroundJobsTool
|
|||
* ]
|
||||
*
|
||||
* @param array $settings
|
||||
* @throws Exception
|
||||
*/
|
||||
public function __construct(array $settings)
|
||||
{
|
||||
|
@ -233,8 +234,6 @@ class BackgroundJobsTool
|
|||
* Get the job status.
|
||||
*
|
||||
* @param string $jobId Background Job Id.
|
||||
*
|
||||
*
|
||||
*/
|
||||
public function getJob(string $jobId)
|
||||
{
|
||||
|
@ -366,9 +365,10 @@ class BackgroundJobsTool
|
|||
/**
|
||||
* Start worker by queue
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $queue Queue name
|
||||
* @param boolean $waitForRestart
|
||||
* @return boolean
|
||||
* @throws Exception
|
||||
*/
|
||||
public function startWorkerByQueue(string $queue, bool $waitForRestart = false): bool
|
||||
{
|
||||
|
@ -401,6 +401,7 @@ class BackgroundJobsTool
|
|||
* @param string|int $id
|
||||
* @param boolean $waitForRestart
|
||||
* @return boolean
|
||||
* @throws Exception
|
||||
*/
|
||||
public function stopWorker($id, bool $waitForRestart = false): bool
|
||||
{
|
||||
|
@ -428,6 +429,7 @@ class BackgroundJobsTool
|
|||
*
|
||||
* @param boolean $waitForRestart
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function restartWorkers(bool $waitForRestart = false)
|
||||
{
|
||||
|
@ -440,6 +442,7 @@ class BackgroundJobsTool
|
|||
*
|
||||
* @param boolean $waitForRestart
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function restartDeadWorkers(bool $waitForRestart = false)
|
||||
{
|
||||
|
@ -499,6 +502,7 @@ class BackgroundJobsTool
|
|||
* Return true if Supervisor process is running.
|
||||
*
|
||||
* @return boolean
|
||||
* @throws Exception
|
||||
*/
|
||||
public function getSupervisorStatus(): bool
|
||||
{
|
||||
|
@ -508,8 +512,8 @@ class BackgroundJobsTool
|
|||
/**
|
||||
* Validate queue
|
||||
*
|
||||
* @param string $queue
|
||||
* @return boolean
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
private function validateQueue(string $queue): bool
|
||||
{
|
||||
|
@ -529,8 +533,8 @@ class BackgroundJobsTool
|
|||
/**
|
||||
* Validate command
|
||||
*
|
||||
* @param string $command
|
||||
* @return boolean
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
private function validateCommand(string $command): bool
|
||||
{
|
||||
|
@ -569,9 +573,14 @@ class BackgroundJobsTool
|
|||
|
||||
/**
|
||||
* @return Redis
|
||||
* @throws Exception
|
||||
*/
|
||||
private function createRedisConnection(): Redis
|
||||
{
|
||||
if (!class_exists('Redis')) {
|
||||
throw new Exception("Class Redis doesn't exists. Please install redis extension for PHP.");
|
||||
}
|
||||
|
||||
$redis = new Redis();
|
||||
$redis->connect($this->settings['redis_host'], $this->settings['redis_port']);
|
||||
$redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_JSON);
|
||||
|
@ -591,6 +600,7 @@ class BackgroundJobsTool
|
|||
|
||||
/**
|
||||
* @return \Supervisor\Supervisor
|
||||
* @throws Exception
|
||||
*/
|
||||
private function getSupervisor()
|
||||
{
|
||||
|
|
|
@ -251,9 +251,14 @@ class PubSubTool
|
|||
/**
|
||||
* @param array $settings
|
||||
* @return Redis
|
||||
* @throws Exception
|
||||
*/
|
||||
private function createRedisConnection(array $settings)
|
||||
{
|
||||
if (!class_exists('Redis')) {
|
||||
throw new Exception("Class Redis doesn't exists. Please install redis extension for PHP.");
|
||||
}
|
||||
|
||||
$redis = new Redis();
|
||||
$redis->connect($settings['redis_host'], $settings['redis_port']);
|
||||
$redisPassword = $settings['redis_password'];
|
||||
|
|
|
@ -2539,7 +2539,7 @@ class AppModel extends Model
|
|||
}
|
||||
|
||||
if (!class_exists('Redis')) {
|
||||
throw new Exception("Class Redis doesn't exists.");
|
||||
throw new Exception("Class Redis doesn't exists. Please install redis extension for PHP.");
|
||||
}
|
||||
|
||||
$host = Configure::read('MISP.redis_host') ?: '127.0.0.1';
|
||||
|
|
|
@ -580,7 +580,13 @@ class Attribute extends AppModel
|
|||
$this->validationErrors['type'] = ['No type set.'];
|
||||
return false;
|
||||
}
|
||||
|
||||
$type = $attribute['type'];
|
||||
if (!isset($this->typeDefinitions[$type])) {
|
||||
$this->validationErrors['type'] = ['Invalid type.'];
|
||||
return false;
|
||||
}
|
||||
|
||||
if (is_array($attribute['value'])) {
|
||||
$this->validationErrors['value'] = ['Value is an array.'];
|
||||
return false;
|
||||
|
|
|
@ -24,7 +24,8 @@ class CryptographicKey extends AppModel
|
|||
|
||||
const ERROR_MALFORMED_SIGNATURE = 'Malformed signature',
|
||||
ERROR_INVALID_SIGNATURE = 'Invalid signature',
|
||||
ERROR_WRONG_KEY = 'Wrong key';
|
||||
ERROR_WRONG_KEY = 'Wrong key',
|
||||
ERROR_INVALID_KEY = 'Invalid key';
|
||||
|
||||
public $validTypes = [
|
||||
'pgp'
|
||||
|
@ -145,25 +146,29 @@ class CryptographicKey extends AppModel
|
|||
{
|
||||
$this->error = false;
|
||||
$fingerprint = $this->__extractPGPKeyData($key);
|
||||
if ($fingerprint === false) {
|
||||
$this->error = self::ERROR_INVALID_KEY;
|
||||
return false;
|
||||
}
|
||||
$data = preg_replace("/\s+/", "", $data);
|
||||
try {
|
||||
$verifiedSignature = $this->gpg->verify($data, $signature);
|
||||
} catch (Exception $e) {
|
||||
$this->error = $this::ERROR_WRONG_KEY;
|
||||
$this->error = self::ERROR_WRONG_KEY;
|
||||
return false;
|
||||
}
|
||||
if (empty($verifiedSignature)) {
|
||||
$this->error = $this::ERROR_MALFORMED_SIGNATURE;
|
||||
$this->error = self::ERROR_MALFORMED_SIGNATURE;
|
||||
return false;
|
||||
}
|
||||
if (!$verifiedSignature[0]->isValid()) {
|
||||
$this->error = $this::ERROR_INVALID_SIGNATURE;
|
||||
$this->error = self::ERROR_INVALID_SIGNATURE;
|
||||
return false;
|
||||
}
|
||||
if ($verifiedSignature[0]->getKeyFingerprint() === $fingerprint) {
|
||||
return true;
|
||||
} else {
|
||||
$this->error = $this::ERROR_WRONG_KEY;
|
||||
$this->error = self::ERROR_WRONG_KEY;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -178,19 +183,22 @@ class CryptographicKey extends AppModel
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $data
|
||||
* @return string|false Primary key fingerprint or false of key is invalid
|
||||
*/
|
||||
private function __extractPGPKeyData($data)
|
||||
{
|
||||
try {
|
||||
$gpgTool = new GpgTool($this->gpg);
|
||||
} catch (Exception $e) {
|
||||
$this->logException("GPG couldn't be initialized, GPG encryption and signing will be not available.", $e, LOG_NOTICE);
|
||||
return '';
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
return $gpgTool->validateGpgKey($data);
|
||||
} catch (Exception $e) {
|
||||
$this->logException("Could not validate PGP key.", $e, LOG_NOTICE);
|
||||
return '';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ App::uses('ProcessTool', 'Tools');
|
|||
* @property ThreatLevel $ThreatLevel
|
||||
* @property Sighting $Sighting
|
||||
* @property Organisation $Org
|
||||
* @property CryptographicKey $CryptographicKey
|
||||
*/
|
||||
class Event extends AppModel
|
||||
{
|
||||
|
|
|
@ -16,15 +16,8 @@
|
|||
'type' => 'simple',
|
||||
'fa-icon' => 'plus',
|
||||
'text' => __('Add authentication key'),
|
||||
'class' => 'btn btn-primary',
|
||||
'onClick' => 'openGenericModal',
|
||||
'onClickParams' => [
|
||||
sprintf(
|
||||
'%s/auth_keys/add%s',
|
||||
$baseurl,
|
||||
empty($user_id) ? '' : ('/' . $user_id)
|
||||
)
|
||||
],
|
||||
'class' => 'btn-primary modal-open',
|
||||
'url' => "$baseurl/auth_keys/add" . (empty($user_id) ? '' : ('/' . $user_id)),
|
||||
'requirement' => $canCreateAuthkey
|
||||
]
|
||||
]
|
||||
|
@ -102,11 +95,9 @@
|
|||
'title' => 'Edit auth key',
|
||||
],
|
||||
[
|
||||
'onclick' => sprintf(
|
||||
'openGenericModal(\'%s/authKeys/delete/[onclick_params_data_path]\');',
|
||||
$baseurl
|
||||
),
|
||||
'onclick_params_data_path' => 'AuthKey.id',
|
||||
'class' => 'modal-open',
|
||||
'url' => "$baseurl/authKeys/delete",
|
||||
'url_params_data_paths' => ['AuthKey.id'],
|
||||
'icon' => 'trash',
|
||||
'title' => __('Delete auth key'),
|
||||
]
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
$eventId = (int) $event['Event']['id'];
|
||||
if (!empty($this->passedArgs['correlation'])) {
|
||||
$attributeFilter = 'correlation';
|
||||
}
|
||||
|
@ -28,7 +29,7 @@
|
|||
'text' => __('Proposal'),
|
||||
'active' => $attributeFilter == 'proposal',
|
||||
'onClick' => 'filterAttributes',
|
||||
'onClickParams' => array('proposal', $event['Event']['id'])
|
||||
'onClickParams' => array('proposal', $eventId)
|
||||
);
|
||||
$simple_filter_data[] = array(
|
||||
'id' => 'filter_correlation',
|
||||
|
@ -44,7 +45,7 @@
|
|||
'text' => __('Warning'),
|
||||
'active' => $attributeFilter == 'warning',
|
||||
'onClick' => 'filterAttributes',
|
||||
'onClickParams' => array('warning', $event['Event']['id'])
|
||||
'onClickParams' => array('warning', $eventId)
|
||||
);
|
||||
$data = array(
|
||||
'children' => array(
|
||||
|
@ -54,9 +55,8 @@
|
|||
'id' => 'create-button',
|
||||
'title' => $possibleAction === 'attribute' ? __('Add attribute') : __('Add proposal'),
|
||||
'fa-icon' => 'plus',
|
||||
'class' => 'last',
|
||||
'onClick' => 'openGenericModal',
|
||||
'onClickParams' => array('/' . $possibleAction . 's/add/' . h($event['Event']['id']))
|
||||
'class' => 'last modal-open',
|
||||
'url' => $baseurl . '/' . $possibleAction . 's/add/' . $eventId,
|
||||
),
|
||||
array(
|
||||
'id' => 'multi-edit-button',
|
||||
|
@ -64,7 +64,7 @@
|
|||
'class' => 'mass-select hidden',
|
||||
'fa-icon' => 'edit',
|
||||
'onClick' => 'editSelectedAttributes',
|
||||
'onClickParams' => array($event['Event']['id'])
|
||||
'onClickParams' => array($eventId)
|
||||
),
|
||||
array(
|
||||
'id' => 'multi-tag-button',
|
||||
|
@ -81,7 +81,7 @@
|
|||
'fa-icon' => 'rebel',
|
||||
'fa-source' => 'fab',
|
||||
'onClick' => 'popoverPopup',
|
||||
'onClickParams' => array('this', 'selected/attribute/eventid:' . h($event['Event']['id']), 'galaxies', 'selectGalaxyNamespace')
|
||||
'onClickParams' => array('this', 'selected/attribute/eventid:' . $eventId, 'galaxies', 'selectGalaxyNamespace')
|
||||
),
|
||||
array(
|
||||
'id' => 'group-into-object-button',
|
||||
|
@ -90,7 +90,7 @@
|
|||
'fa-icon' => 'object-group',
|
||||
'fa-source' => 'fa',
|
||||
'onClick' => 'proposeObjectsFromSelectedAttributes',
|
||||
'onClickParams' => array('this', $event['Event']['id'])
|
||||
'onClickParams' => array('this', $eventId)
|
||||
),
|
||||
array(
|
||||
'id' => 'multi-delete-button',
|
||||
|
@ -98,7 +98,7 @@
|
|||
'class' => 'mass-select hidden',
|
||||
'fa-icon' => 'trash',
|
||||
'onClick' => 'multiSelectAction',
|
||||
'onClickParams' => array($event['Event']['id'], 'deleteAttributes')
|
||||
'onClickParams' => array($eventId, 'deleteAttributes')
|
||||
),
|
||||
array(
|
||||
'id' => 'multi-accept-button',
|
||||
|
@ -106,7 +106,7 @@
|
|||
'class' => 'mass-proposal-select hidden',
|
||||
'fa-icon' => 'check-circle',
|
||||
'onClick' => 'multiSelectAction',
|
||||
'onClickParams' => array($event['Event']['id'], 'acceptProposals')
|
||||
'onClickParams' => array($eventId, 'acceptProposals')
|
||||
),
|
||||
array(
|
||||
'id' => 'multi-discard-button',
|
||||
|
@ -114,7 +114,7 @@
|
|||
'class' => 'mass-proposal-select hidden',
|
||||
'fa-icon' => 'times',
|
||||
'onClick' => 'multiSelectAction',
|
||||
'onClickParams' => array($event['Event']['id'], 'discardProposals')
|
||||
'onClickParams' => array($eventId, 'discardProposals')
|
||||
),
|
||||
array(
|
||||
'id' => 'multi-sighting-button',
|
||||
|
@ -132,7 +132,7 @@
|
|||
'title' => __('Populate using a template'),
|
||||
'fa-icon' => 'list',
|
||||
'onClick' => 'getPopup',
|
||||
'onClickParams' => array($event['Event']['id'], 'templates', 'templateChoices'),
|
||||
'onClickParams' => array($eventId, 'templates', 'templateChoices'),
|
||||
'requirement' => $mayModify
|
||||
),
|
||||
array(
|
||||
|
@ -140,14 +140,14 @@
|
|||
'title' => __('Populate using the freetext import tool'),
|
||||
'fa-icon' => 'align-left',
|
||||
'onClick' => 'getPopup',
|
||||
'onClickParams' => array($event['Event']['id'], 'events', 'freeTextImport')
|
||||
'onClickParams' => array($eventId, 'events', 'freeTextImport')
|
||||
),
|
||||
array(
|
||||
'id' => 'attribute-replace-button',
|
||||
'title' => __('Replace all attributes of a category/type combination within the event'),
|
||||
'fa-icon' => 'random',
|
||||
'onClick' => 'getPopup',
|
||||
'onClickParams' => array($event['Event']['id'], 'attributes', 'attributeReplace'),
|
||||
'onClickParams' => array($eventId, 'attributes', 'attributeReplace'),
|
||||
'requirement' => $mayModify
|
||||
)
|
||||
)
|
||||
|
@ -236,7 +236,7 @@
|
|||
'fa-icon' => 'times',
|
||||
'title' => __('Remove filters'),
|
||||
'onClick' => 'filterAttributes',
|
||||
'onClickParams' => array('all', $event['Event']['id'])
|
||||
'onClickParams' => array('all', $eventId)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
|
|
@ -114,13 +114,22 @@
|
|||
$action['onclick']
|
||||
);
|
||||
}
|
||||
$title = empty($action['title']) ? '' : h($action['title']);
|
||||
|
||||
$classes = [];
|
||||
if (!empty($action['class'])) {
|
||||
$classes[] = h($action['class']);
|
||||
}
|
||||
if (!empty($action['dbclickAction'])) {
|
||||
$classes[] = 'dblclickActionElement';
|
||||
}
|
||||
echo sprintf(
|
||||
'<a href="%s" title="%s" aria-label="%s" %s %s><i class="black %s"></i></a> ',
|
||||
'<a href="%s" title="%s" aria-label="%s"%s%s><i class="black %s"></i></a> ',
|
||||
$url,
|
||||
empty($action['title']) ? '' : h($action['title']),
|
||||
empty($action['title']) ? '' : h($action['title']),
|
||||
empty($action['dbclickAction']) ? '' : 'class="dblclickActionElement"',
|
||||
empty($action['onclick']) ? '' : sprintf('onclick="event.preventDefault();%s"', $action['onclick']),
|
||||
$title,
|
||||
$title,
|
||||
empty($classes) ? '' : ' class="' . implode(' ', $classes) . '"',
|
||||
empty($action['onclick']) ? '' : sprintf(' onclick="event.preventDefault();%s"', $action['onclick']),
|
||||
$this->FontAwesome->getClass($action['icon'])
|
||||
);
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
}
|
||||
$onClickParams = implode(',', $onClickParams);
|
||||
$onClick = sprintf(
|
||||
'onClick="%s%s"',
|
||||
'onclick="%s%s"',
|
||||
(empty($data['url'])) ? 'event.preventDefault();' : '',
|
||||
(!empty($data['onClick']) ? sprintf(
|
||||
'%s(%s)',
|
||||
|
@ -54,4 +54,3 @@
|
|||
empty($data['badge']) ? '' : sprintf('<span class="badge badge-%s">%s</span>', empty($data['badge']['type']) ? 'info' : $data['badge']['type'], h($data['badge']['text']))
|
||||
);
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -27,26 +27,20 @@ $divider = $this->element('/genericElements/SideMenu/side_menu_divider');
|
|||
echo $this->element('/genericElements/SideMenu/side_menu_link', array(
|
||||
'element_id' => 'dashboardImport',
|
||||
'text' => __('Import Config JSON'),
|
||||
'onClick' => array(
|
||||
'function' => 'openGenericModal',
|
||||
'params' => array($baseurl . '/dashboards/import')
|
||||
),
|
||||
'url' => $baseurl . '/dashboards/import',
|
||||
'link_class' => 'modal-open',
|
||||
));
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_link', array(
|
||||
'element_id' => 'dashboardExport',
|
||||
'text' => __('Export Config JSON'),
|
||||
'onClick' => array(
|
||||
'function' => 'openGenericModal',
|
||||
'params' => array($baseurl . '/dashboards/export')
|
||||
),
|
||||
'url' => $baseurl . '/dashboards/export',
|
||||
'link_class' => 'modal-open',
|
||||
));
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_link', array(
|
||||
'element_id' => 'dashboardSave',
|
||||
'text' => __('Save Dashboard Config'),
|
||||
'onClick' => array(
|
||||
'function' => 'openGenericModal',
|
||||
'params' => array($baseurl . '/dashboards/saveTemplate')
|
||||
),
|
||||
'url' => $baseurl . '/dashboards/saveTemplate',
|
||||
'link_class' => 'modal-open',
|
||||
));
|
||||
echo $this->element('/genericElements/SideMenu/side_menu_link', array(
|
||||
'element_id' => 'dashboardTemplateIndex',
|
||||
|
@ -55,7 +49,7 @@ $divider = $this->element('/genericElements/SideMenu/side_menu_divider');
|
|||
));
|
||||
break;
|
||||
case 'event':
|
||||
$eventId = intval($event['Event']['id']);
|
||||
$eventId = (int)$event['Event']['id'];
|
||||
echo '<div id="hiddenSideMenuData" class="hidden" data-event-id="' . $eventId . '"></div>';
|
||||
if (in_array($menuItem, array('editEvent', 'addAttribute', 'addObject', 'addAttachment', 'addIOC', 'addThreatConnect', 'populateFromTemplate', 'merge'))) {
|
||||
// we can safely assume that mayModify is true if coming from these actions, as they require it in the controller and the user has already passed that check
|
||||
|
|
|
@ -29,6 +29,9 @@ if (empty($url)) {
|
|||
if (!empty($title)) {
|
||||
$a .= ' title="' . h($title) . '"';
|
||||
}
|
||||
if (!empty($link_class)) {
|
||||
$a .= ' class="' . h($link_class) . '"';
|
||||
}
|
||||
if (!empty($onClick)) {
|
||||
$params = '';
|
||||
foreach ($onClick['params'] as $param) {
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
$event = Hash::extract($data, $field['event_path']);
|
||||
if ($event['protected']) {
|
||||
echo sprintf(
|
||||
'<span class="fas fa-lock"></span> %s %s %s <br />',
|
||||
'<span class="fas fa-lock"></span> %s %s %s <br>',
|
||||
__('Event is in protected mode. (Limited distribution)'),
|
||||
!$field['owner'] ? '' : sprintf(
|
||||
'<br /><a href="#" onClick="%s" title="%s"><i class="fas fa-unlock"></i> %s</a>',
|
||||
'<br><a href="%s" class="modal-open" title="%s"><i class="fas fa-unlock"></i> %s</a>',
|
||||
sprintf(
|
||||
"openGenericModal('%s/events/unprotect/%s');",
|
||||
'%s/events/unprotect/%s',
|
||||
$baseurl,
|
||||
h($event['id'])
|
||||
),
|
||||
|
@ -16,11 +16,10 @@
|
|||
empty($field['text']) ? __('Switch to unprotected mode') : h($field['text'])
|
||||
),
|
||||
!$field['owner'] ? '' : sprintf(
|
||||
'<br /><a href="#" onClick="%s"><i class="fas fa-key"></i>%s</a>',
|
||||
'<br><a href="%s" class="modal-open"><i class="fas fa-key"></i> %s</a>',
|
||||
sprintf(
|
||||
"openGenericModal('%s/CryptographicKeys/add/%s/%s');",
|
||||
"%s/CryptographicKeys/add/Event/%s",
|
||||
$baseurl,
|
||||
h('Event'),
|
||||
h($event['id'])
|
||||
),
|
||||
empty($field['text']) ? __('Add signing key') : h($field['text'])
|
||||
|
@ -33,7 +32,7 @@
|
|||
$foundInstanceKey = true;
|
||||
}
|
||||
echo sprintf(
|
||||
'%s<span class="bold">%s</span> (%s) <a href="#" onClick="%s" title="%s"><i class="fas fa-search"></i></a> %s<br />',
|
||||
'%s<span class="bold">%s</span> (%s) <a href="%s" class="modal-open" title="%s"><i class="fas fa-search"></i></a> %s<br>',
|
||||
!$isInstanceKey ? '' : sprintf(
|
||||
'<i class="fas fa-home blue" title="%s"></i> ',
|
||||
__('This is the instance signing key. When synchronising the instance, this will be the key used to validate the event.')
|
||||
|
@ -41,13 +40,13 @@
|
|||
h($key['type']),
|
||||
empty($key['fingerprint']) ? '#' . h($key['id']) : h($key['fingerprint']),
|
||||
sprintf(
|
||||
"openGenericModal('%s/cryptographicKeys/view/%s');",
|
||||
"%s/cryptographicKeys/view/%s",
|
||||
$baseurl,
|
||||
h($key['id'])
|
||||
),
|
||||
__('Inspect key'),
|
||||
!$field['owner'] ? '' : sprintf(
|
||||
'<a href="#" onClick="openGenericModal(\'%s/cryptographicKeys/delete/%s\')" title="%s"><i class="fas fa-trash"></i></a>',
|
||||
'<a href="%s/cryptographicKeys/delete/%s" class="modal-open" title="%s"><i class="fas fa-trash"></i></a>',
|
||||
$baseurl,
|
||||
h($key['id']),
|
||||
__('Detach key from the event. This key will no longer be used to sign and validate this event.')
|
||||
|
@ -64,12 +63,12 @@
|
|||
}
|
||||
} else {
|
||||
echo sprintf(
|
||||
'<span class="fas fa-unlock"></span> <span>%s</span> %s<br />',
|
||||
'<span class="fas fa-unlock"></span> <span>%s</span> %s<br>',
|
||||
__('Event is in unprotected mode.'),
|
||||
!$field['owner'] ? '' : sprintf(
|
||||
'<br /><a href="#" onClick="%s" title="%s"><i class="fas fa-lock"></i> %s</a>',
|
||||
'<br><a href="%s" class="modal-open" title="%s"><i class="fas fa-lock"></i> %s</a>',
|
||||
sprintf(
|
||||
"openGenericModal('%s/events/protect/%s');",
|
||||
"%s/events/protect/%s",
|
||||
$baseurl,
|
||||
h($event['id'])
|
||||
),
|
||||
|
@ -78,4 +77,3 @@
|
|||
)
|
||||
);
|
||||
}
|
||||
//echo ;
|
||||
|
|
|
@ -82,7 +82,7 @@
|
|||
);
|
||||
}
|
||||
}
|
||||
$ajaxLists = '<br/>';
|
||||
$ajaxLists = '<br>';
|
||||
if (!empty($children)) {
|
||||
foreach ($children as $child) {
|
||||
$ajaxLists .= $this->element(
|
||||
|
@ -131,4 +131,4 @@
|
|||
$appendHtml,
|
||||
$ajax ? '' : $this->element('/genericElements/SideMenu/side_menu', $menuData)
|
||||
);
|
||||
?>
|
||||
|
||||
|
|
|
@ -544,7 +544,7 @@
|
|||
);
|
||||
}
|
||||
?>
|
||||
<div id="topBar" class="navbar navbar-inverse <?= $debugMode ?>">
|
||||
<div id="topBar" class="navbar navbar-inverse <?= isset($debugMode) ? $debugMode : 'debugOff' ?>">
|
||||
<div class="navbar-inner">
|
||||
<ul class="nav">
|
||||
<?php
|
||||
|
|
|
@ -70,7 +70,7 @@
|
|||
[
|
||||
'key' => __('Contributors'),
|
||||
'type' => 'custom',
|
||||
'function' => function ($data) use($contributors, $baseurl, $event) {
|
||||
'function' => function ($data) use ($contributors, $baseurl, $event) {
|
||||
$contributorsContent = [];
|
||||
foreach ($contributors as $organisationId => $name) {
|
||||
$org = ['Organisation' => ['id' => $organisationId, 'name' => $name]];
|
||||
|
@ -243,7 +243,7 @@
|
|||
'key' => __('Delegation request'),
|
||||
'class' => 'background-red bold',
|
||||
'type' => 'delegationRequest',
|
||||
'delegationRequest' => empty($delegationRequest) ? null : $delegationRequest,
|
||||
'delegationRequest' => isset($delegationRequest) ? $delegationRequest : null,
|
||||
'requirement' => !empty($delegationRequest)
|
||||
],
|
||||
[
|
||||
|
@ -254,7 +254,7 @@
|
|||
return sprintf(
|
||||
'%s%s',
|
||||
$data['Event']['disable_correlation'] ? __('Disabled') : __('Enabled'),
|
||||
(!$mayModify && !$isSiteAdmin) ? '' : sprintf(
|
||||
(!$mayModify && !$isSiteAdmin) ? '' :
|
||||
sprintf(
|
||||
' (<a onClick="getPopup(%s);" style="%scursor:pointer;font-weight:normal;">%s</a>)',
|
||||
sprintf(
|
||||
|
@ -264,7 +264,6 @@
|
|||
$data['Event']['disable_correlation'] ? 'color:white;' : '',
|
||||
$data['Event']['disable_correlation'] ? __('enable') : __('disable')
|
||||
)
|
||||
)
|
||||
);
|
||||
},
|
||||
'requirement' => (!Configure::read('MISP.completely_disable_correlation') && Configure::read('MISP.allow_disabling_correlation'))
|
||||
|
@ -302,4 +301,3 @@
|
|||
]
|
||||
]
|
||||
);
|
||||
?>
|
||||
|
|
|
@ -84,18 +84,16 @@ if ($isSiteAdmin) {
|
|||
$actions = [
|
||||
[
|
||||
'url' => $baseurl . '/admin/roles/edit',
|
||||
'url_params_data_paths' => array(
|
||||
'Role.id'
|
||||
),
|
||||
'url_params_data_paths' => ['Role.id'],
|
||||
'icon' => 'edit',
|
||||
'title' => __('Edit role'),
|
||||
],
|
||||
[
|
||||
'onclick' => sprintf(
|
||||
'openGenericModal(\'%s/admin/roles/delete/[onclick_params_data_path]\');',
|
||||
$baseurl
|
||||
),
|
||||
'onclick_params_data_path' => 'Role.id',
|
||||
'class' => 'modal-open',
|
||||
'url' => "$baseurl/admin/roles/delete",
|
||||
'url_params_data_paths' => ['Role.id'],
|
||||
'icon' => 'trash',
|
||||
'title' => __('Delete role'),
|
||||
]
|
||||
];
|
||||
} else {
|
||||
|
@ -116,14 +114,8 @@ echo $this->element('genericElements/IndexTable/scaffold', [
|
|||
'type' => 'simple',
|
||||
'text' => __('Add role'),
|
||||
'fa-icon' => 'plus',
|
||||
'class' => 'btn btn-primary',
|
||||
'onClick' => 'openGenericModal',
|
||||
'onClickParams' => [
|
||||
sprintf(
|
||||
'%s/admin/roles/add',
|
||||
$baseurl
|
||||
)
|
||||
],
|
||||
'class' => 'btn-primary modal-open',
|
||||
'url' => "$baseurl/admin/roles/add",
|
||||
'requirement' => $isSiteAdmin,
|
||||
]
|
||||
]
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1220,13 +1220,12 @@ function openGenericModal(url, modalData, callback) {
|
|||
} else {
|
||||
htmlData = data;
|
||||
}
|
||||
$('body').append(htmlData);
|
||||
$(document.body).append(htmlData);
|
||||
$('#genericModal').modal().on('shown', function() {
|
||||
if (callback !== undefined) {
|
||||
callback();
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
error: function (data, textStatus, errorThrown) {
|
||||
showMessage('fail', textStatus + ": " + errorThrown);
|
||||
|
@ -3969,7 +3968,7 @@ function flashErrorPopover() {
|
|||
$("#gray_out").fadeIn();
|
||||
}
|
||||
|
||||
$('body').on('click', function (e) {
|
||||
$(document.body).on('click', function (e) {
|
||||
$('[data-toggle=popover]').each(function () {
|
||||
// hide any open popovers when the anywhere else in the body is clicked
|
||||
if (typeof currentPopover !== 'undefined' && currentPopover !== '') {
|
||||
|
@ -4766,7 +4765,7 @@ $(document.body).on('click', '.quickSelect', function() {
|
|||
selection.addRange(range);
|
||||
});
|
||||
|
||||
// Any link with data-paginator attribute will be treat as AJAX paginator
|
||||
// Any link with data-paginator attribute will be treated as AJAX paginator
|
||||
$(document.body).on('click', 'a[data-paginator]', function (e) {
|
||||
e.preventDefault();
|
||||
var paginatorTarget = $(this).attr('data-paginator');
|
||||
|
@ -4782,6 +4781,12 @@ $(document.body).on('click', 'a[data-paginator]', function (e) {
|
|||
});
|
||||
});
|
||||
|
||||
// Any link with modal-open class will be treated as generic modal
|
||||
$(document.body).on('click', 'a.modal-open', function (e) {
|
||||
e.preventDefault();
|
||||
openGenericModal($(this).attr('href'));
|
||||
});
|
||||
|
||||
function queryEventLock(event_id, timestamp) {
|
||||
if (!document.hidden) {
|
||||
$.ajax({
|
||||
|
@ -5303,7 +5308,7 @@ function redirectIdSelection(scope, action) {
|
|||
}
|
||||
}
|
||||
|
||||
$('body').on('click', '.hex-value-convert', function() {
|
||||
$(document.body).on('click', '.hex-value-convert', function() {
|
||||
var $hexValueSpan = $(this).parent().children(':first-child');
|
||||
var val = $hexValueSpan.text().trim();
|
||||
if (!$hexValueSpan.hasClass('binary-representation')) {
|
||||
|
|
Loading…
Reference in New Issue