Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Critical case severity #939

Merged
merged 3 commits into from
Apr 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions thehive-backend/app/models/Alert.scala
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ trait AlertAttributes {
Attribute("alert", "ioc", OptionalAttributeFormat(F.booleanFmt), Nil, None, "")
)
}

val alertId: A[String] = attribute("_id", F.stringFmt, "Alert id", O.readonly)
val tpe: A[String] = attribute("type", F.stringFmt, "Type of the alert", O.readonly)
val source: A[String] = attribute("source", F.stringFmt, "Source of the alert", O.readonly)
Expand All @@ -70,7 +70,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)
Expand Down
6 changes: 3 additions & 3 deletions thehive-backend/app/models/AttributeFormat.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ 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")))
)
)

Expand Down
2 changes: 1 addition & 1 deletion thehive-backend/app/models/Case.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion thehive-backend/app/models/CaseTemplate.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
3 changes: 2 additions & 1 deletion ui/app/scripts/services/Constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down
15 changes: 9 additions & 6 deletions ui/app/views/directives/severity.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
<div ng-if="active == true">
<span class="label" ng-class="{ true:'label-info', false:'label-default' }[value == 1]" ng-click="update(1)">L</span>
<span class="label" ng-class="{ true:'label-warning', false:'label-default' }[value == 2 || !value]" ng-click="update(2)">M</span>
<span class="label" ng-class="{ true:'label-danger', false:'label-default' }[value == 3]" ng-click="update(3)">H</span>
<span class="label" ng-class="{ true:'label-success', false:'label-default' }[value == 1]" ng-click="update(1)">L</span>
<span class="label" ng-class="{ true:'label-info', false:'label-default' }[value == 2 || !value]" ng-click="update(2)">M</span>
<span class="label" ng-class="{ true:'label-warning', false:'label-default' }[value == 3]" ng-click="update(3)">H</span>
<span class="label" ng-class="{ true:'label-danger', false:'label-default' }[value == 4]" ng-click="update(4)">!!</span>

</div>
<span ng-if="active != true" ng-switch="value">
<span ng-switch-when="1" class="label label-info">L</span>
<span ng-switch-when="2" class="label label-warning">M</span>
<span ng-switch-when="3" class="label label-danger">H</span>
<span ng-switch-when="1" class="label label-success">L</span>
<span ng-switch-when="2" class="label label-info">M</span>
<span ng-switch-when="3" class="label label-warning">H</span>
<span ng-switch-when="4" class="label label-danger">!!</span>
<span ng-switch-default class="label label-primary">?</span>
</span>
2 changes: 1 addition & 1 deletion ui/app/views/partials/alert/list/filters.html
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ <h4>Filters</h4>
<tags-input class="form-control form-control-wrapper"
min-length="2"
ng-model="$vm.filtering.activeFilters.severity.value"
placeholder="ex: High, Medium, Low"
placeholder="ex: Critical, High, Medium, Low"
replace-spaces-with-dashes="false"
add-from-autocomplete-only="true">
<auto-complete load-on-focus="true" load-on-down-arrow="true" min-length="1" source="$vm.getSeverities($query)"></auto-complete>
Expand Down
2 changes: 1 addition & 1 deletion ui/app/views/partials/case/list/filters.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ <h4>Filters</h4>
<tags-input class="form-control form-control-wrapper"
min-length="2"
ng-model="$vm.uiSrv.activeFilters.severity.value"
placeholder="ex: High, Medium, Low"
placeholder="ex: Critical, High, Medium, Low"
replace-spaces-with-dashes="false"
add-from-autocomplete-only="true">
<auto-complete load-on-focus="true" load-on-down-arrow="true" min-length="1" source="$vm.getSeverities($query)"></auto-complete>
Expand Down