From a221fc958d347a49925b98fe605b72c66b453a7b Mon Sep 17 00:00:00 2001 From: Zachary Priddy Date: Sun, 24 Mar 2019 21:30:44 -0700 Subject: [PATCH] Add Critical Status --- thehive-backend/app/models/Alert.scala | 2 +- thehive-backend/app/models/AttributeFormat.scala | 6 +++--- thehive-backend/app/models/Case.scala | 2 +- thehive-backend/app/models/CaseTemplate.scala | 2 +- ui/app/scripts/services/Constants.js | 3 ++- ui/app/views/directives/severity.html | 15 +++++++++------ ui/app/views/partials/alert/list/filters.html | 2 +- ui/app/views/partials/case/list/filters.html | 2 +- 8 files changed, 19 insertions(+), 15 deletions(-) diff --git a/thehive-backend/app/models/Alert.scala b/thehive-backend/app/models/Alert.scala index d2290749d3..26a3205bb9 100644 --- a/thehive-backend/app/models/Alert.scala +++ b/thehive-backend/app/models/Alert.scala @@ -55,7 +55,7 @@ trait AlertAttributes { val caze: A[Option[String]] = optionalAttribute("case", F.stringFmt, "Id of the case, if created") val title: A[String] = attribute("title", F.textFmt, "Title of the alert") val description: A[String] = attribute("description", F.textFmt, "Description of the alert") - val severity: A[Long] = attribute("severity", SeverityAttributeFormat, "Severity if the alert (0-3)", 2L) + val severity: A[Long] = attribute("severity", SeverityAttributeFormat, "Severity if the alert (1-4)", 2L) val tags: A[Seq[String]] = multiAttribute("tags", F.stringFmt, "Alert tags") val tlp: A[Long] = attribute("tlp", TlpAttributeFormat, "TLP level", 2L) val artifacts: A[Seq[JsObject]] = multiAttribute("artifacts", F.objectFmt(artifactAttributes), "Artifact of the alert", O.unaudited) diff --git a/thehive-backend/app/models/AttributeFormat.scala b/thehive-backend/app/models/AttributeFormat.scala index fd98a30140..a6d00d0df7 100644 --- a/thehive-backend/app/models/AttributeFormat.scala +++ b/thehive-backend/app/models/AttributeFormat.scala @@ -11,15 +11,15 @@ import org.elastic4play.{ AttributeError, InvalidFormatAttributeError } object SeverityAttributeFormat extends NumberAttributeFormat { - def isValidValue(value: Long): Boolean = 1 <= value && value <= 3 + def isValidValue(value: Long): Boolean = 1 <= value && value <= 4 override def definition(dblists: DBLists, attribute: Attribute[Long]): Seq[AttributeDefinition] = Seq(AttributeDefinition( attribute.attributeName, name, attribute.description, - Seq(JsNumber(1), JsNumber(2), JsNumber(3)), - Seq("low", "medium", "high"))) + Seq(JsNumber(1), JsNumber(2), JsNumber(3), JsNumber(4)), + Seq("low", "medium", "high", "critical"))) override def checkJson(subNames: Seq[String], value: JsValue): Or[JsValue, One[InvalidFormatAttributeError]] = { value match { diff --git a/thehive-backend/app/models/Case.scala b/thehive-backend/app/models/Case.scala index 2c2b4e3c01..5d58d4692a 100644 --- a/thehive-backend/app/models/Case.scala +++ b/thehive-backend/app/models/Case.scala @@ -37,7 +37,7 @@ trait CaseAttributes { _: AttributeDef ⇒ val caseId: A[Long] = attribute("caseId", F.numberFmt, "Id of the case (auto-generated)", O.model) val title: A[String] = attribute("title", F.textFmt, "Title of the case") val description: A[String] = attribute("description", F.textFmt, "Description of the case") - val severity: A[Long] = attribute("severity", SeverityAttributeFormat, "Severity if the case is an incident (0-3)", 2L) + val severity: A[Long] = attribute("severity", SeverityAttributeFormat, "Severity if the case is an incident (1-4)", 2L) val owner: A[String] = attribute("owner", F.userFmt, "Owner of the case") val startDate: A[Date] = attribute("startDate", F.dateFmt, "Creation date", new Date) val endDate: A[Option[Date]] = optionalAttribute("endDate", F.dateFmt, "Resolution date") diff --git a/thehive-backend/app/models/CaseTemplate.scala b/thehive-backend/app/models/CaseTemplate.scala index 144aa4fc61..ead7c77da7 100644 --- a/thehive-backend/app/models/CaseTemplate.scala +++ b/thehive-backend/app/models/CaseTemplate.scala @@ -19,7 +19,7 @@ trait CaseTemplateAttributes { _: AttributeDef ⇒ val templateName: A[String] = attribute("name", F.stringFmt, "Name of the template") val titlePrefix: A[Option[String]] = optionalAttribute("titlePrefix", F.textFmt, "Title of the case") val description: A[Option[String]] = optionalAttribute("description", F.textFmt, "Description of the case") - val severity: A[Option[Long]] = optionalAttribute("severity", SeverityAttributeFormat, "Severity if the case is an incident (0-5)") + val severity: A[Option[Long]] = optionalAttribute("severity", SeverityAttributeFormat, "Severity if the case is an incident (1-4)") val tags: A[Seq[String]] = multiAttribute("tags", F.stringFmt, "Case tags") val flag: A[Option[Boolean]] = optionalAttribute("flag", F.booleanFmt, "Flag of the case") val tlp: A[Option[Long]] = optionalAttribute("tlp", TlpAttributeFormat, "TLP level") diff --git a/ui/app/scripts/services/Constants.js b/ui/app/scripts/services/Constants.js index 0bae8587ac..9ae839dcb1 100644 --- a/ui/app/scripts/services/Constants.js +++ b/ui/app/scripts/services/Constants.js @@ -16,11 +16,12 @@ }) .value('Severity', { keys: { + Critical: 4, High: 3, Medium: 2, Low: 1 }, - values: ['Unknown', 'Low', 'Medium', 'High'] + values: ['Unknown', 'Low', 'Medium', 'High', 'Critical'] }) .value('AlertStatus', { values: ['New', 'Updated', 'Ignored', 'Imported'] diff --git a/ui/app/views/directives/severity.html b/ui/app/views/directives/severity.html index 193495b93a..74f74b3bbb 100644 --- a/ui/app/views/directives/severity.html +++ b/ui/app/views/directives/severity.html @@ -1,11 +1,14 @@
- L - M - H + L + M + H + !! +
- L - M - H + L + M + H + !! ? diff --git a/ui/app/views/partials/alert/list/filters.html b/ui/app/views/partials/alert/list/filters.html index 33c873611f..8f91ead91d 100644 --- a/ui/app/views/partials/alert/list/filters.html +++ b/ui/app/views/partials/alert/list/filters.html @@ -89,7 +89,7 @@

Filters

diff --git a/ui/app/views/partials/case/list/filters.html b/ui/app/views/partials/case/list/filters.html index 9566871ff9..a7208c5fc6 100644 --- a/ui/app/views/partials/case/list/filters.html +++ b/ui/app/views/partials/case/list/filters.html @@ -71,7 +71,7 @@

Filters