diff --git a/src/opnsense/mvc/app/controllers/OPNsense/IDS/Api/SettingsController.php b/src/opnsense/mvc/app/controllers/OPNsense/IDS/Api/SettingsController.php index dedce7a73..e67185c09 100644 --- a/src/opnsense/mvc/app/controllers/OPNsense/IDS/Api/SettingsController.php +++ b/src/opnsense/mvc/app/controllers/OPNsense/IDS/Api/SettingsController.php @@ -104,10 +104,13 @@ class SettingsController extends ApiMutableModelControllerBase $searchPhrase = ''; } - // add filter for classtype - if ($this->request->getPost("classtype", "string", '') != "") { - $searchTag = $filter->sanitize($this->request->getPost('classtype'), "query"); - $searchPhrase .= " classtype/" . $searchTag . ' '; + // add metadata filters + foreach ($_POST as $key => $value) { + $key = $filter->sanitize($key, "string"); + $value = $filter->sanitize($value, "string"); + if (!in_array($key, ['current', 'rowCount', 'sort', 'searchPhrase', 'action'])) { + $searchPhrase .= " {$key}/{$value} "; + } } // add filter for action diff --git a/src/opnsense/mvc/app/views/OPNsense/IDS/index.volt b/src/opnsense/mvc/app/views/OPNsense/IDS/index.volt index 5aa8ba3e2..0c4115da5 100644 --- a/src/opnsense/mvc/app/views/OPNsense/IDS/index.volt +++ b/src/opnsense/mvc/app/views/OPNsense/IDS/index.volt @@ -62,27 +62,31 @@ POSSIBILITY OF SUCH DAMAGE. /** * list all known classtypes and add to selection box */ - function updateRuleClassTypes() { + function updateRuleMetadata() { ajaxGet("/api/ids/settings/listRuleMetadata", {}, function(data, status) { if (status == "success") { - $('#ruleclass').html(''); - $.each(data['classtype'], function(key, value) { - $('#ruleclass').append($("").attr("value",value).text(value)); + $('#rulemetadata').empty(); + $.each(Object.assign({}, {'action': ['drop', 'alert']}, data), function(key, values) { + let $optgroup = $(""); + $optgroup.prop('label', key); + for (let i=0; i < values.length ; ++i) { + $optgroup.append( + $("