Skip to content

Commit

Permalink
Merge branch 'release/1.1.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
To-om committed Sep 15, 2017
2 parents e0d2258 + 9b54e03 commit 481afb8
Show file tree
Hide file tree
Showing 11 changed files with 74 additions and 22 deletions.
34 changes: 30 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,34 @@
# Change Log

## [1.1.3](https://github.com/CERT-BDF/Cortex/tree/1.1.3)
## [1.1.4](https://github.com/CERT-BDF/Cortex/tree/1.1.4) (2017-09-15)
[Full Changelog](https://github.com/CERT-BDF/Cortex/compare/1.1.3...1.1.4)

[Full Changelog](https://github.com/CERT-BDF/Cortex/compare/debian/1.1.2...1.1.3)
**Implemented enhancements:**

- Group ownership in Docker image prevents running on OpenShift [\#42](https://github.com/CERT-BDF/Cortex/issues/42)

**Fixed bugs:**

- Display a error notification on analyzer start fail [\#39](https://github.com/CERT-BDF/Cortex/issues/39)
- Cortex removes the input details from failure reports [\#38](https://github.com/CERT-BDF/Cortex/issues/38)

**Closed issues:**

- Disable analyzer in configuration file [\#32](https://github.com/CERT-BDF/Cortex/issues/32)

## [1.1.3](https://github.com/CERT-BDF/Cortex/tree/1.1.3) (2017-06-14)
[Full Changelog](https://github.com/CERT-BDF/Cortex/compare/debian/1.1.2-2...1.1.3)

**Fixed bugs:**

- Problem Start Cortex on Ubuntu 16.04 [\#35](https://github.com/CERT-BDF/Cortex/issues/35)
- Error when parsing analyzer failure report [\#33](https://github.com/CERT-BDF/Cortex/issues/33)

## [debian/1.1.2-2](https://github.com/CERT-BDF/Cortex/tree/debian/1.1.2-2) (2017-05-24)
[Full Changelog](https://github.com/CERT-BDF/Cortex/compare/1.1.2...debian/1.1.2-2)

## [1.1.2](https://github.com/CERT-BDF/Cortex/tree/1.1.2) (2017-05-24)
[Full Changelog](https://github.com/CERT-BDF/Cortex/compare/debian/1.1.1...1.1.2)
[Full Changelog](https://github.com/CERT-BDF/Cortex/compare/debian/1.1.1-2...1.1.2)

**Implemented enhancements:**

Expand All @@ -24,13 +41,22 @@
- Cortex and MISP unclear and error-loop [\#29](https://github.com/CERT-BDF/Cortex/issues/29)
- Error 500 in TheHive when a job is submited to Cortex [\#27](https://github.com/CERT-BDF/Cortex/issues/27)

## [debian/1.1.1-2](https://github.com/CERT-BDF/Cortex/tree/debian/1.1.1-2) (2017-05-19)
[Full Changelog](https://github.com/CERT-BDF/Cortex/compare/rpm/1.1.1-2...debian/1.1.1-2)

## [rpm/1.1.1-2](https://github.com/CERT-BDF/Cortex/tree/rpm/1.1.1-2) (2017-05-19)
[Full Changelog](https://github.com/CERT-BDF/Cortex/compare/1.1.1...rpm/1.1.1-2)

**Fixed bugs:**

- After Upgrade from Cortex 1.0.2 to 1.1.1 system does not come up [\#26](https://github.com/CERT-BDF/Cortex/issues/26)

## [1.1.1](https://github.com/CERT-BDF/Cortex/tree/1.1.1) (2017-05-17)
[Full Changelog](https://github.com/CERT-BDF/Cortex/compare/1.1.0...1.1.1)

**Fixed bugs:**

- Missing logos and favicons [\#25](https://github.com/CERT-BDF/Cortex/issues/25)
- After Upgrade from Cortex 1.0.2 to 1.1.1 system does not come up [\#26](https://github.com/CERT-BDF/Cortex/issues/26)

**Closed issues:**

Expand Down
2 changes: 1 addition & 1 deletion app/models/Job.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ case class Job(id: String, analyzer: Analyzer, artifact: Artifact, report: Futur

def status: JobStatus.Type = report.value match {
case Some(Success(SuccessReport(_, _, _))) JobStatus.Success
case Some(Success(FailureReport(_))) JobStatus.Failure
case Some(Success(FailureReport(_, _))) JobStatus.Failure
case Some(Failure(_)) JobStatus.Failure
case None JobStatus.InProgress
}
Expand Down
9 changes: 6 additions & 3 deletions app/models/JsonFormat.scala
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,11 @@ object JsonFormat {
full (json \ "full").asOpt[JsObject]
summary (json \ "summary").asOpt[JsObject]
} yield SuccessReport(artifacts, full, summary))
.getOrElse(FailureReport(s"Invalid analyzer output format : $json"))
.getOrElse(FailureReport(s"Invalid analyzer output format : $json", JsNull))
else
FailureReport((json \ "errorMessage").asOpt[String].getOrElse(json.toString))
FailureReport(
(json \ "errorMessage").asOpt[String].getOrElse(json.toString),
(json \ "input").asOpt[JsObject].getOrElse(JsNull))
}
}

Expand All @@ -62,8 +64,9 @@ object JsonFormat {
"full" full,
"summary" summary,
"success" true)
case FailureReport(message) Json.obj(
case FailureReport(message, input) Json.obj(
"errorMessage" message,
"input" input,
"success" false)
}

Expand Down
4 changes: 2 additions & 2 deletions app/models/Report.scala
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package models

import play.api.libs.json.JsObject
import play.api.libs.json.{ JsObject, JsValue }

sealed abstract class Report(success: Boolean)

case class SuccessReport(artifacts: Seq[Artifact], full: JsObject, summary: JsObject) extends Report(true)

case class FailureReport(message: String) extends Report(false)
case class FailureReport(message: String, input: JsValue) extends Report(false)
17 changes: 13 additions & 4 deletions app/services/ExternalAnalyzerSrv.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ import scala.util.{ Failure, Try }
@Singleton
class ExternalAnalyzerSrv(
analyzerPath: Path,
disabledAnalyzers: Seq[String],
analyzerConfig: JsObject,
akkaSystem: ActorSystem) {

@Inject() def this(configuration: Configuration, akkaSystem: ActorSystem) =
this(
Paths.get(configuration.getString("analyzer.path").getOrElse(".")),
configuration.getStringSeq("analyzer.disabled").getOrElse(Nil),
JsonConfig.configWrites.writes(configuration.getConfig("analyzer.config").getOrElse(Configuration.empty)),
akkaSystem)

Expand All @@ -53,7 +55,14 @@ class ExternalAnalyzerSrv(
Failure(error)
}
.toOption
_ = logger.info(s"Register analyzer ${analyzer.name} ${analyzer.version} (${analyzer.id})")
.flatMap {
case a if disabledAnalyzers.contains(a.id)
logger.info(s"Analyzer ${a.name} ${a.version} (${a.id}) is disabled")
None
case a
logger.info(s"Register analyzer ${a.name} ${a.version} (${a.id})")
Some(a)
}
} yield analyzer
}

Expand Down Expand Up @@ -100,12 +109,12 @@ class ExternalAnalyzerSrv(
catch {
case _: JsonMappingException
error.append(output)
FailureReport(s"Error: Invalid output\n$error")
FailureReport(s"Error: Invalid output\n$error", JsNull)
case _: JsonParseException
error.append(output)
FailureReport(s"Error: Invalid output\n$error")
FailureReport(s"Error: Invalid output\n$error", JsNull)
case t: Throwable
FailureReport(t.getMessage + ":" + t.getStackTrace.mkString("", "\n\t", "\n"))
FailureReport(t.getMessage + ":" + t.getStackTrace.mkString("", "\n\t", "\n"), JsNull)
}
}(analyzeExecutionContext)
}
Expand Down
4 changes: 2 additions & 2 deletions app/services/MispSrv.scala
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ class MispSrv(
}
.getOrElse {
val message = (mispOutput \ "error").asOpt[String].getOrElse(mispOutput.toString)
FailureReport(message)
FailureReport(message, JsNull)
}
}

Expand All @@ -205,7 +205,7 @@ class MispSrv(
"values" Json.arr(Json.toJson(report).toString))

Json.obj("results" (attributes :+ cortexAttribute))
case FailureReport(message)
case FailureReport(message, _)
Json.obj("error" message)
}
}
Expand Down
12 changes: 9 additions & 3 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ linuxMakeStartScript in Debian := None

// RPM //
rpmRelease := "1"
rpmVendor in Rpm := "TheHive Project"
rpmVendor := "TheHive Project"
rpmUrl := Some("http://thehive-project.org/")
rpmLicense := Some("AGPL")
rpmRequirements += "java-1.8.0-openjdk-headless"
Expand Down Expand Up @@ -130,7 +130,12 @@ mappings in Docker ~= (_.filterNot {
})

dockerCommands ~= { dc =>
val (dockerInitCmds, dockerTailCmds) = dc.splitAt(4)
val (dockerInitCmds, dockerTailCmds) = dc
.collect {
case ExecCmd("RUN", "chown", _*) => ExecCmd("RUN", "chown", "-R", "daemon:root", ".")
case other => other
}
.splitAt(4)
dockerInitCmds ++
Seq(
Cmd("USER", "root"),
Expand All @@ -146,7 +151,8 @@ dockerCommands ~= { dc =>
"rm -rf misp_modules /var/lib/apt/lists/* /tmp/*"),
Cmd("ADD", "var", "/var"),
Cmd("ADD", "etc", "/etc"),
ExecCmd("RUN", "chown", "-R", "daemon:daemon", "/var/log/cortex")) ++
ExecCmd("RUN", "chown", "-R", "daemon:root", "/var/log/cortex"),
ExecCmd("RUN", "chmod", "+x", "/opt/cortex/bin/cortex", "/opt/cortex/entrypoint", "/opt/cortex/contrib/misp-modules-loader.py")) ++
dockerTailCmds
}

Expand Down
8 changes: 8 additions & 0 deletions ui/app/scripts/controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ angular.module('cortex')
_.each(response, function(resp) {
NotificationService.success(resp.data.analyzerId + ' started successfully on ' + (resp.data.artifact.data || resp.data.artifact.attributes.filename));
});
}).catch(function(err) {
if(err != 'cancel') {
NotificationService.error(('An error occurred: ' + err.statusText) || 'An unexpected error occurred');
}
});
});
};
Expand Down Expand Up @@ -83,6 +87,10 @@ angular.module('cortex')
}).then(function (response) {
$state.go('jobs');
NotificationService.success(response.data.analyzerId + ' started successfully on ' + response.data.artifact.data);
}).catch(function(err) {
if(err != 'cancel') {
NotificationService.error(('An error occurred: ' + err.statusText) || 'An unexpected error occurred');
}
});
};

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": "cortex",
"version": "1.1.3",
"version": "1.1.4",
"dependencies": {
"angular": "1.5.10",
"angular-sanitize": "1.5.10",
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": "cortex",
"version": "1.1.3",
"version": "1.1.4",
"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 := "1.1.3"
version in ThisBuild := "1.1.4"

0 comments on commit 481afb8

Please sign in to comment.