Skip to content

Commit

Permalink
Merge branch 'develop-th4' into cascade-remove
Browse files Browse the repository at this point in the history
  • Loading branch information
To-om committed Mar 16, 2021
2 parents c509ac9 + 6bea47a commit d615f91
Show file tree
Hide file tree
Showing 10 changed files with 132 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
---
name: Bug Report for TheHive 3.x
about: Create a bug report for TheHive 3.x
title: "[Bug]"
labels: bug, TheHive3
assignees: ''

---

# EDIT THIS TITLE BEFORE POSTING. Use this template for bug reports. If you'd like to request a feature, please be as descriptive as possible and delete the template except the first section (Request Type)

### Request Type
(select Bug or Feature Request and **remove this part**)
Bug / Feature Request
Bug

### Work Environment

Expand All @@ -27,4 +35,4 @@ Describe the problem/bug as clearly as possible.
(keep this section if you have suggestions on how to solve the problem. **Otherwise delete it**)

### Complementary information
(add anything that can help identifying the problem such as **log** excerpts, **screenshots**, **configuration dumps** etc.)
(add anything that can help identifying the problem such as **log** excerpts, **screenshots**, **configuration dumps** etc.)
38 changes: 38 additions & 0 deletions .github/ISSUE_TEMPLATE/thehive4_bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: Bug Report for TheHive4
about: Create a bug report for TheHive 4.
title: "[Bug]"
labels: bug, TheHive4
assignees: ''

---

# EDIT THIS TITLE BEFORE POSTING. Use this template for bug reports. If you'd like to request a feature, please be as descriptive as possible and delete the template except the first section (Request Type)

### Request Type
Bug

### Work Environment

| Question | Answer
|---------------------------|--------------------
| OS version (server) | Debian, Ubuntu, CentOS, RedHat, ...
| OS version (client) | XP, Seven, 10, Ubuntu, ...
| TheHive version / git hash | 4.x, hash of the commit
| Package Type | RPM, DEB, Docker, Binary, From source
| Browser type & version | If applicable


### Problem Description
Describe the problem/bug as clearly as possible.

### Steps to Reproduce
1. step 1
1. step 2
1. step 3...

### Possible Solutions
(keep this section if you have suggestions on how to solve the problem. **Otherwise delete it**)

### Complementary information
(add anything that can help identifying the problem such as **log** excerpts, **screenshots**, **configuration dumps** etc.)
31 changes: 31 additions & 0 deletions .github/ISSUE_TEMPLATE/thehive4_feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
name: Feature Request for TheHive4
about: Create a feature request for TheHive 4.
title: "[Bug]"
labels: "feature request", TheHive4
assignees: ''
---

# EDIT THIS TITLE BEFORE POSTING. Use this template for bug reports. If you'd like to request a feature, please be as descriptive as possible and delete the template except the first section (Request Type)

### Request Type

Feature Request

### Work Environment

| Question | Answer
|---------------------------|--------------------
| TheHive version | 4.x

### Feature Description

Describe feature as clearly as possible.

### Possible Solutions

(keep this section if you have suggestions on how to solve the purpose. **Otherwise delete it**)

### Complementary information

(add anything that can help identifying the problem such as **log** excerpts, **screenshots**, **configuration dumps** etc.)
26 changes: 26 additions & 0 deletions .github/ISSUE_TEMPLATE/thehive4_question.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
name: Ask question about TheHive 4
about: Ask a question about TheHive 4
title: "[Question]"
labels: question, TheHive 4
assignees: ''

---

### Request Type

Question

### Work Environment

| Question | Answer
|---------------------------|--------------------
| OS version (server) | Debian, Ubuntu, CentOS, RedHat, ...
| OS version (client) | XP, Seven, 10, Ubuntu, ...
| TheHive version / git hash | 4.x, hash of the commit
| Package Type | RPM, DEB, Docker, Binary, From source
| Browser type & version | If applicable

### Question

Describe the question/requirement as clearly as possible.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
})
.finally(function () {
if($scope.analysisEnabled) {
$scope.jobs = CortexSrv.list($scope, $scope.caseId, observableId, $scope.onJobsChange);
$scope.jobs = CortexSrv.listJobs($scope, $scope.caseId, observableId, $scope.onJobsChange);
}
});

Expand Down
29 changes: 16 additions & 13 deletions frontend/app/scripts/services/api/CortexSrv.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,30 @@
(function() {
'use strict';
angular.module('theHiveServices').service('CortexSrv', function($q, $http, $rootScope, $uibModal, QuerySrv, StatSrv, StreamSrv, AnalyzerSrv, PSearchSrv, ModalUtilsSrv) {
angular.module('theHiveServices').service('CortexSrv', function($q, $http, $rootScope, $uibModal, QuerySrv, PaginatedQuerySrv, StreamSrv, AnalyzerSrv, PSearchSrv, ModalUtilsSrv) {
var self = this;
var baseUrl = './api/connector/cortex';

this.list = function(scope, caseId, observableId, callback) {
return PSearchSrv(undefined, 'connector/cortex/job', {
this.listJobs = function(scope, caseId, observableId, callback) {
return new PaginatedQuerySrv({
name: 'observable-jobs-' + observableId,
version: 'v1',
scope: scope,
sort: ['-startDate'],
streamObjectType: 'case_artifact_job',
loadAll: false,
sort: ['-startDate'],
pageSize: 200,
onUpdate: callback || angular.noop,
streamObjectType: 'case_artifact_job',
filter: {
_parent: {
_type: 'observable',
_query: {
_id: observableId
}
}
operations: [
{ '_name': 'getObservable', 'idOrName': observableId },
{ '_name': 'jobs' }
],
guard: function(updates) {
return _.find(updates, function(item) {
return (item.base.details.objectType === 'Observable') && (item.base.details.objectId === observableId);
}) !== undefined;
}
});
};
}

this.getJobs = function(caseId, observableId, analyzerId, limit) {

Expand Down
2 changes: 1 addition & 1 deletion thehive/app/org/thp/thehive/controllers/v0/CaseCtrl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class CaseCtrl @Inject() (
.organisations(Permissions.manageCase)
.get(request.organisation)
.orFail(AuthorizationError("Operation not permitted"))
user <- userSrv.current.getOrFail("User")
user <- inputCase.user.fold(userSrv.current.getOrFail("User"))(userSrv.getByName(_).getOrFail("User"))
caseTemplate <- caseTemplateName.map(ct => caseTemplateSrv.get(EntityIdOrName(ct)).visible.richCaseTemplate.getOrFail("CaseTemplate")).flip
richCase <- caseSrv.create(
caseTemplate.fold(inputCase)(inputCase.withCaseTemplate).toCase,
Expand Down
2 changes: 1 addition & 1 deletion thehive/app/org/thp/thehive/controllers/v1/CaseCtrl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class CaseCtrl @Inject() (
for {
caseTemplate <- caseTemplateName.map(ct => caseTemplateSrv.get(EntityIdOrName(ct)).visible.richCaseTemplate.getOrFail("CaseTemplate")).flip
organisation <- userSrv.current.organisations(Permissions.manageCase).get(request.organisation).getOrFail("Organisation")
user <- userSrv.current.getOrFail("User")
user <- inputCase.user.fold(userSrv.current.getOrFail("User"))(userSrv.getByName(_).getOrFail("User"))
richCase <- caseSrv.create(
caseTemplate.fold(inputCase)(inputCase.withCaseTemplate).toCase,
Some(user),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ class CaseCtrlTest extends PlaySpecification with TestAppBuilder {
"flag":false,
"status":"Waiting"
}
]
],
"user":"[email protected]"
}"""
)
.as[JsObject]
Expand All @@ -140,7 +141,7 @@ class CaseCtrlTest extends PlaySpecification with TestAppBuilder {
pap = 2,
status = "Open",
tags = Set.empty,
owner = Some("certuser@thehive.local"),
owner = Some("certro@thehive.local"),
stats = JsObject.empty
)
)
Expand All @@ -155,7 +156,7 @@ class CaseCtrlTest extends PlaySpecification with TestAppBuilder {
val assignee = app[Database].roTransaction(implicit graph => app[CaseSrv].get(EntityIdOrName(outputCase._id)).assignee.getOrFail("Case"))

assignee must beSuccessfulTry
assignee.get.login shouldEqual "certuser@thehive.local"
assignee.get.login shouldEqual "certro@thehive.local"
}

"try to get a case" in testApp { app =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ class CaseCtrlTest extends PlaySpecification with TestAppBuilder {
tags = Set("tag1", "tag2"),
flag = Some(false),
tlp = Some(1),
pap = Some(3)
pap = Some(3),
user = Some("[email protected]")
)
)
)
Expand All @@ -77,7 +78,7 @@ class CaseCtrlTest extends PlaySpecification with TestAppBuilder {
pap = 3,
status = "Open",
summary = None,
user = Some("certuser@thehive.local"),
user = Some("certro@thehive.local"),
customFields = Seq.empty
)

Expand Down

0 comments on commit d615f91

Please sign in to comment.