Skip to content

Commit d7d9245

Browse files
committed
Merge tag '2.0.2' into develop
2.0.2
2 parents 48cdf6d + c81438e commit d7d9245

File tree

13 files changed

+101
-11899
lines changed

13 files changed

+101
-11899
lines changed

CHANGELOG.md

+17-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# Change Log
22

3+
## [2.0.2](https://github.com/TheHive-Project/Cortex/tree/2.02)
4+
5+
[Full Changelog](https://github.com/TheHive-Project/Cortex/compare/2.0.1...2.0.2)
6+
7+
**Fixed bugs:**
8+
9+
- Silently failure when ElasticSearch is unreachable [\#76](https://github.com/TheHive-Project/Cortex/issues/76)
10+
- Coretxutils and TypeError: argument of type 'bool' is not iterable [\#73](https://github.com/TheHive-Project/Cortex/issues/73)
11+
- Unable to disable analyzers [\#72](https://github.com/TheHive-Project/Cortex/issues/72)
12+
- Cortex 2 is not passing proxy variable to analyzers [\#71](https://github.com/TheHive-Project/Cortex/issues/71)
13+
- Session collision when TheHive & Cortex 2 share the same URL [\#70](https://github.com/TheHive-Project/Cortex/issues/70)
14+
315
## [2.0.1](https://github.com/TheHive-Project/Cortex/tree/2.0.1) (2018-03-30)
416
[Full Changelog](https://github.com/TheHive-Project/Cortex/compare/2.0.0...2.0.1)
517

@@ -9,7 +21,7 @@
921
- Packages contain obsolete configuration sample [\#68](https://github.com/TheHive-Project/Cortex/issues/68)
1022
- User can't change his password [\#67](https://github.com/TheHive-Project/Cortex/issues/67)
1123

12-
## [2.0.0](https://github.com/TheHive-Project/Cortex/tree/2.0.0) (2018-03-29)
24+
## [2.0.0](https://github.com/TheHive-Project/Cortex/tree/2.0.0) (2018-03-30)
1325
[Full Changelog](https://github.com/TheHive-Project/Cortex/compare/1.1.4...2.0.0)
1426

1527
**Implemented enhancements:**
@@ -63,6 +75,9 @@
6375
- Problem Start Cortex on Ubuntu 16.04 [\#35](https://github.com/TheHive-Project/Cortex/issues/35)
6476
- Error when parsing analyzer failure report [\#33](https://github.com/TheHive-Project/Cortex/issues/33)
6577

78+
## [debian/1.1.2-2](https://github.com/TheHive-Project/Cortex/tree/debian/1.1.2-2) (2017-05-24)
79+
[Full Changelog](https://github.com/TheHive-Project/Cortex/compare/1.1.2...debian/1.1.2-2)
80+
6681
## [1.1.2](https://github.com/TheHive-Project/Cortex/tree/1.1.2) (2017-05-24)
6782
[Full Changelog](https://github.com/TheHive-Project/Cortex/compare/debian/1.1.1-2...1.1.2)
6883

@@ -142,4 +157,4 @@
142157
## [1.0.0](https://github.com/TheHive-Project/Cortex/tree/1.0.0) (2017-02-01)
143158

144159

145-
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
160+
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*

app/org/thp/cortex/models/Job.scala

+4-1
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,8 @@ class JobModel @Inject() () extends ModelDef[JobModel, Job]("job", "Job", "/job"
4545
class Job(model: JobModel, attributes: JsObject) extends EntityDef[JobModel, Job](model, attributes) with JobAttributes {
4646
val params: JsObject = Try(Json.parse(parameters()).as[JsObject]).getOrElse(JsObject.empty)
4747

48-
override def toJson: JsObject = super.toJson + ("date" -> Json.toJson(createdAt))
48+
override def toJson: JsObject = {
49+
val output = super.toJson + ("date" -> Json.toJson(createdAt))
50+
input().fold(output)(i output + ("input" -> Json.parse(i)))
51+
}
4952
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package org.thp.cortex.services
2+
3+
import javax.inject.{ Inject, Provider, Singleton }
4+
5+
import play.api.Logger
6+
import play.api.http.SessionConfiguration
7+
import play.api.libs.crypto.CSRFTokenSigner
8+
import play.api.mvc.RequestHeader
9+
import play.filters.csrf.CSRF.{ ErrorHandler CSRFErrorHandler, TokenProvider }
10+
import play.filters.csrf.CSRFConfig
11+
12+
import akka.stream.Materializer
13+
14+
object CSRFFilter {
15+
private[CSRFFilter] lazy val logger = Logger(getClass)
16+
17+
def shouldProtect(request: RequestHeader): Boolean = {
18+
val isLogin = request.uri.startsWith("/api/login")
19+
val isApi = request.uri.startsWith("/api")
20+
val isInSession = request.session.data.nonEmpty
21+
val check = !isLogin && isApi && isInSession
22+
logger.debug(s"[csrf] uri ${request.uri} (isLogin=$isLogin, isApi=$isApi, isInSession=$isInSession): ${if (check) "" else "don't"} check")
23+
check
24+
}
25+
26+
}
27+
28+
@Singleton
29+
class CSRFFilter @Inject() (
30+
config: Provider[CSRFConfig],
31+
tokenSignerProvider: Provider[CSRFTokenSigner],
32+
sessionConfiguration: SessionConfiguration,
33+
tokenProvider: TokenProvider,
34+
errorHandler: CSRFErrorHandler)(mat: Materializer)
35+
extends play.filters.csrf.CSRFFilter(
36+
config.get.copy(shouldProtect = CSRFFilter.shouldProtect),
37+
tokenSignerProvider.get,
38+
sessionConfiguration,
39+
tokenProvider,
40+
errorHandler)(mat)

app/org/thp/cortex/services/JobSrv.scala

+3-3
Original file line numberDiff line numberDiff line change
@@ -415,9 +415,9 @@ class JobSrv(
415415
.validatedBy(_.read(configAndParam))
416416
.map(cfg Json.obj("config" -> JsObject(cfg).deepMerge(analyzerDefinition.configuration)))
417417
.map { cfg
418-
val proxy_http = (cfg \ "proxy_http").asOpt[String].fold(JsObject.empty) { proxy Json.obj("proxy" -> Json.obj("http" -> proxy)) }
419-
val proxy_https = (cfg \ "proxy_https").asOpt[String].fold(JsObject.empty) { proxy Json.obj("proxy" -> Json.obj("https" -> proxy)) }
420-
cfg.deepMerge(proxy_http).deepMerge(proxy_https)
418+
val proxy_http = (cfg \ "config" \ "proxy_http").asOpt[String].fold(JsObject.empty) { proxy Json.obj("proxy" -> Json.obj("http" -> proxy)) }
419+
val proxy_https = (cfg \ "config" \ "proxy_https").asOpt[String].fold(JsObject.empty) { proxy Json.obj("proxy" -> Json.obj("https" -> proxy)) }
420+
cfg.deepMerge(Json.obj("config" -> (proxy_http.deepMerge(proxy_https))))
421421
}
422422
.map(_ deepMerge artifact +
423423
("dataType" -> JsString(job.dataType())) +

conf/reference.conf

+5-3
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,19 @@ cache {
1313
# HTTP filters
1414
play.filters {
1515
# name of cookie in which the CSRF token is transmitted to client
16-
csrf.cookie.name = XSRF-TOKEN
16+
csrf.cookie.name = CORTEX-XSRF-TOKEN
1717
# name of header in which the client should send CSRD token
18-
csrf.header.name = X-XSRF-TOKEN
18+
csrf.header.name = X-CORTEX-XSRF-TOKEN
1919

2020
enabled = [
2121
org.thp.cortex.services.StreamFilter,
2222
org.elastic4play.services.TempFilter,
23-
// global.CSRFFilter
23+
org.thp.cortex.services.CSRFFilter
2424
]
2525
}
2626

27+
play.http.session.cookieName = CORTEX_SESSION
28+
2729
# ElasticSearch
2830
search {
2931
# Name of the index

version.sbt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version in ThisBuild := "2.0.1"
1+
version in ThisBuild := "2.0.2"

www/.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ bower_components/
55
.tmp/
66
true!ng-annotate/
77
dist/
8+
package-lock.json
9+
config/manifest.json

www/config/manifest.json

-1
This file was deleted.

0 commit comments

Comments
 (0)