Skip to content

Commit

Permalink
Merge branch 'release/3.4.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
To-om committed Apr 25, 2020
2 parents 49a38e3 + 0f91566 commit 7928e97
Show file tree
Hide file tree
Showing 10 changed files with 74 additions and 26 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Change Log

## [3.4.2](https://github.com/TheHive-Project/TheHive/milestone/57) (2020-04-25)

**Implemented enhancements:**

- [Feature Request] Providing output details for Responders [\#962](https://github.com/TheHive-Project/TheHive/issues/962)

**Fixed bugs:**

- Analyzer's artifacts tags and message are not kept when importing observables [\#1285](https://github.com/TheHive-Project/TheHive/issues/1285)
- [Bug] File observables in alert are not created in case [\#1292](https://github.com/TheHive-Project/TheHive/issues/1292)

## [3.4.1](https://github.com/TheHive-Project/TheHive/milestone/53) (2020-04-17)

**Implemented enhancements:**
Expand Down
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ logLevel := Level.Info
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.6.23")
addSbtPlugin("org.foundweekends" % "sbt-bintray" % "0.5.1")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.0.0")
addSbtPlugin("org.thehive-project" % "sbt-github-changelog" % "0.2.0")
addSbtPlugin("org.thehive-project" % "sbt-github-changelog" % "0.3.0")
4 changes: 3 additions & 1 deletion thehive-backend/app/controllers/ArtifactCtrl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@ class ArtifactCtrl @Inject()(
} yield {
for {
hashes attachmentSrv.getHashes(attachmentId)
size attachmentSrv.getSize(attachmentId)
size attachmentSrv.getSize(attachmentId).recover {
case _: NoSuchElementException 0 // workaround until elastic4play#93 is fixed
}
} yield fields.set("attachment", AttachmentInputValue(name, hashes, size.toLong, contentType, attachmentId))
}
artifactFields.fold[Future[Seq[Fields]]](Future.successful(Nil))(_.map(f Seq(f)))
Expand Down
48 changes: 30 additions & 18 deletions thehive-backend/app/services/AlertSrv.scala
Original file line number Diff line number Diff line change
Expand Up @@ -302,31 +302,43 @@ class AlertSrv(
.flatMap { artifact
val tags = (artifact \ "tags").asOpt[Seq[JsString]].getOrElse(Nil) :+ JsString("src:" + alert.tpe())
val message = (artifact \ "message").asOpt[JsString].getOrElse(JsString(""))
(artifact \ "dataType").asOpt[String].flatMap {
case "file"
(artifact \ "data").asOpt[String].collect {
case dataExtractor(filename, contentType, data)
val f = Files.createTempFile("alert-", "-attachment")
Files.write(f, java.util.Base64.getDecoder.decode(data))
(artifact \ "dataType")
.asOpt[String]
.flatMap {
case "file" if !artifact.value.contains("attachment")
(artifact \ "data").asOpt[String].collect {
case dataExtractor(filename, contentType, data)
val f = Files.createTempFile("alert-", "-attachment")
Files.write(f, java.util.Base64.getDecoder.decode(data))
Fields(
artifact +
("tags" JsArray(tags)) +
("message" message)
).set("attachment", FileInputValue(filename, f, contentType))
.unset("data")
}
case "file"
Some(
Fields(
artifact +
("tags" JsArray(tags)) +
("message" message)
).set("attachment", FileInputValue(filename, f, contentType))
.unset("data")
}
case _ if artifact.value.contains("data")
Some(
Fields(
artifact +
("tags" JsArray(tags)) +
("message" message)
)
)
)
case _
case _ if artifact.value.contains("data")
Some(
Fields(
artifact +
("tags" JsArray(tags)) +
("message" message)
)
)
case _ None
}
.orElse {
logger.warn(s"Invalid artifact format: $artifact")
None
}
}
}

val updatedCase = artifactSrv
Expand Down
8 changes: 7 additions & 1 deletion ui/app/scripts/directives/responder-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,14 @@
actions: '=',
header: '@'
},
templateUrl: 'views/directives/responder-actions.html',
templateUrl: 'views/directives/responder-actions.html',
controller: function($scope, $uibModal) {
_.each($scope.actions.values, function(action) {
if(action.status === 'Failure') {
action.errorMessage = (JSON.parse(action.report) || {}).errorMessage;
}
});

$scope.showResponderJob = function(action) {
$uibModal.open({
scope: $scope,
Expand Down
10 changes: 10 additions & 0 deletions ui/app/styles/case.css
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,13 @@ table.case-list .case-tags .label,
font-size: 12px !important;
font-weight: normal;
}

pre.error-trace {
color: #a94442;
border: none;
font-size: 10px;
word-wrap: break-word;
word-break: break-all;
white-space: pre-wrap;
background-color: #f9f1f1;
}
11 changes: 9 additions & 2 deletions ui/app/views/directives/responder-actions.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,18 @@ <h4 class="text-primary">{{header}}</h4>
'InProgress': 'label-warning',
'Failure': 'label-danger'}[action.status]">{{action.status}}</span>
</td>
<td>{{action.responderName}}</td>
<td>
<div>{{action.responderName}}</div>
<div ng-if="action.status === 'Failure'" class="text-danger wrap mt-xxs">
<a class="text-danger" href
ng-click="action.showError = !!!action.showError">{{action.showError ? 'Hide' : 'Show'}} error</a>
<pre ng-show="action.showError" class="error-trace">{{action.errorMessage}}</pre>
</div>
</td>
<td>{{action.cortexId}}</td>
<td>{{action.startDate | shortDate}}</td>
<td class="text-center">
<a href class="noline" ng-click="showResponderJob(action)"><i class="fa fa-search"></i></a>
<a ng-if="action.status !== 'Failure'" href class="noline" ng-click="showResponderJob(action)" uib-tooltip="Show action report" tooltip-placement="left-middle"><i class="fa fa-search"></i></a>
</td>
</tr>
</tbody>
Expand Down
2 changes: 1 addition & 1 deletion ui/bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "thehive",
"version": "3.4.0-RC2",
"version": "3.4.2",
"license": "AGPL-3.0",
"dependencies": {
"jquery": "^3.4.1",
Expand Down
2 changes: 1 addition & 1 deletion ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "thehive",
"version": "3.4.0-RC2",
"version": "3.4.2",
"license": "AGPL-3.0",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion version.sbt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version in ThisBuild := "3.4.1-1"
version in ThisBuild := "3.4.2-1"

0 comments on commit 7928e97

Please sign in to comment.