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

[Bug] Unable to enumerate tasks via API #1483

Closed
aacgood opened this issue Aug 18, 2020 · 4 comments
Closed

[Bug] Unable to enumerate tasks via API #1483

aacgood opened this issue Aug 18, 2020 · 4 comments
Assignees
Labels
bug TheHive4 TheHive4 related issues
Milestone

Comments

@aacgood
Copy link

aacgood commented Aug 18, 2020

Request Type

Bug

Work Environment

Question Answer
OS version (server) Ubuntu
OS version (client) 10
TheHive version / git hash 4.0.0-1
Package Type DEB
Browser type & version Chrome

Problem Description

When attempting to list out a cases tasks via the API, a NotFoundError error is returned. Issue does not happen when using TheHive v3. This prevents enumerating the tasks that have been added to a case when using the API.

Steps to Reproduce

  1. Using Postman create a new POST request to https://thehive4.local/api/case/{casenum}/task/_search

Error is returned

{
    "type": "NotFoundError",
    "message": "/api/case/{casenum}/task/_search"
}

** where {casenum} is the actual reference ID of a case and not its friendly case number

Performing the same test when using TheHive v3 shows the tasks that are associated to a case

Complementary information

image
image

Logs from v4

2020-08-18 07:41:43,088 [WARN] from org.thp.scalligraph.ErrorHandler in application-akka.actor.default-dispatcher-6527 [|] POST /api/case/4256/task/_search returned 404
org.thp.scalligraph.NotFoundError: /api/case/4256/task/_search
        at org.thp.scalligraph.ScalligraphRouter$$anonfun$2.$anonfun$applyOrElse$3(ScalligraphRouter.scala:104)
        at org.thp.scalligraph.auth.AuthSrvWithActionFunction$$anon$1.$anonfun$invokeBlock$2(AuthSrv.scala:91)
        at scala.Option.fold(Option.scala:251)
        at org.thp.scalligraph.auth.AuthSrvWithActionFunction$$anon$1.invokeBlock(AuthSrv.scala:90)
        at org.thp.scalligraph.auth.AuthSrvWithActionFunction$$anon$1.invokeBlock(AuthSrv.scala:87)
        at org.thp.scalligraph.auth.BasicAuthSrv$$anon$1.$anonfun$invokeBlock$1(BasicAuthSrv.scala:52)
        at scala.Option.fold(Option.scala:251)
        at org.thp.scalligraph.auth.BasicAuthSrv$$anon$1.invokeBlock(BasicAuthSrv.scala:52)
        at org.thp.scalligraph.auth.BasicAuthSrv$$anon$1.invokeBlock(BasicAuthSrv.scala:50)
        at org.thp.scalligraph.auth.SessionAuthSrv$$anon$1.$anonfun$invokeBlock$1(SessionAuthSrv.scala:87)
        at scala.Option.fold(Option.scala:251)
        at org.thp.scalligraph.auth.SessionAuthSrv$$anon$1.invokeBlock(SessionAuthSrv.scala:87)
        at org.thp.scalligraph.auth.SessionAuthSrv$$anon$1.invokeBlock(SessionAuthSrv.scala:84)
        at org.thp.scalligraph.ScalligraphRouter$$anonfun$2.$anonfun$applyOrElse$2(ScalligraphRouter.scala:100)
        at play.api.mvc.ActionBuilderImpl.invokeBlock(Action.scala:441)
        at play.api.mvc.ActionBuilderImpl.invokeBlock(Action.scala:439)
        at play.api.mvc.ActionBuilder$$anon$9.apply(Action.scala:379)
        at play.api.mvc.Action.$anonfun$apply$4(Action.scala:82)
        at play.api.libs.streams.StrictAccumulator.$anonfun$mapFuture$4(Accumulator.scala:168)
        at scala.util.Try$.apply(Try.scala:213)
        at play.api.libs.streams.StrictAccumulator.$anonfun$mapFuture$3(Accumulator.scala:168)
        at scala.Function1.$anonfun$andThen$1(Function1.scala:57)
        at scala.Function1.$anonfun$andThen$1(Function1.scala:57)
        at play.api.libs.streams.StrictAccumulator.run(Accumulator.scala:199)
        at play.core.server.AkkaHttpServer.$anonfun$runAction$4(AkkaHttpServer.scala:416)
        at akka.http.scaladsl.util.FastFuture$.strictTransform$1(FastFuture.scala:41)
        at akka.http.scaladsl.util.FastFuture$.$anonfun$transformWith$3(FastFuture.scala:51)
        at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:64)
        at org.thp.scalligraph.ContextPropagatingDisptacher$$anon$1.$anonfun$execute$2(ContextPropagatingDisptacher.scala:56)
        at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
        at org.thp.scalligraph.DiagnosticContext$.$anonfun$withDiagnosticContext$2(ContextPropagatingDisptacher.scala:91)
        at org.thp.scalligraph.DiagnosticContext$.saveDiagnosticContext(ContextPropagatingDisptacher.scala:106)
        at org.thp.scalligraph.DiagnosticContext$.withDiagnosticContext(ContextPropagatingDisptacher.scala:89)
        at org.thp.scalligraph.DiagnosticContext$$anon$2.withContext(ContextPropagatingDisptacher.scala:74)
        at org.thp.scalligraph.ContextPropagatingDisptacher$$anon$1.$anonfun$execute$1(ContextPropagatingDisptacher.scala:56)
        at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:48)
        at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(ForkJoinExecutorConfigurator.scala:48)
        at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
        at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
        at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
        at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:175)
@aacgood aacgood added TheHive4 TheHive4 related issues bug labels Aug 18, 2020
@Explie
Copy link
Contributor

Explie commented Aug 25, 2020

There currently is no routing for /api/case/{caseid}/task/_search thats why you get a NotFoundError.
But there is a /api/case/task/_search endpoint which should do the same.

Can you confirm?

@aacgood
Copy link
Author

aacgood commented Aug 25, 2020

That API endpoint works @Explie, however it does not link the parent id of the case it belongs too

id          : 12456
_id         : 12456
createdBy   : [email protected]
updatedBy   : [email protected]
createdAt   : 1598397416230
updatedAt   : 1598397443245
_type       : case_task
title       :  default
group       : default
description : Task Description Notes here
              - Item 1
              - Item 2
              - Item 3
              - Item 4
owner       : [email protected]
status      : InProgress
flag        : False
startDate   : 1598397418466
order       : 0

@Explie
Copy link
Contributor

Explie commented Aug 26, 2020

Yes, but this is true for all API calls to the Hive4 API at the moment. At least I think so. And I don't know whether it is missing or intended to be like that. IMHO probably another issue on its own.

@nadouani
Copy link
Contributor

Hello, if the /api/case/{caseid}/task/_search is missing, then this is a bug. It should be there for backward compatibility.

@nadouani nadouani added this to the 4.0.1 milestone Aug 31, 2020
To-om added a commit that referenced this issue Sep 7, 2020
@To-om To-om closed this as completed Sep 7, 2020
To-om added a commit that referenced this issue Sep 7, 2020
To-om added a commit that referenced this issue Sep 7, 2020
To-om added a commit that referenced this issue Sep 7, 2020
To-om added a commit that referenced this issue Sep 8, 2020
To-om added a commit that referenced this issue Sep 8, 2020
To-om added a commit that referenced this issue Nov 13, 2020
To-om added a commit that referenced this issue Nov 13, 2020
To-om added a commit that referenced this issue Nov 13, 2020
To-om added a commit that referenced this issue Nov 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug TheHive4 TheHive4 related issues
Projects
None yet
Development

No branches or pull requests

4 participants