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

Cannot Deleted user - Error "OrgUserCtrl: org.thp.thehive.models.User not found" #1253

Closed
Krypterya opened this issue Mar 5, 2020 · 4 comments
Assignees
Labels
bug TheHive4 TheHive4 related issues
Milestone

Comments

@Krypterya
Copy link

Bug

Work Environment

Question Answer
OS version (server) CentOS
OS version (client) 7
TheHive version 4.0 RC1
Package Type RPM
Browser type & version Firefox 73.0.1

Problem Description

When trying to delete a user from an organisation in TheHive4 interface, the action fails with the error: "OrgUserCtrl: org.thp.thehive.models.User not found"

Steps to Reproduce

  1. Log in as default admin on web interface of TheHive
  2. Create new organisation
  3. Create a user
  4. Click on the "remove" link next to the user to delete the user

Complementary information

Application log output of one such attempt to delete a user:

2020-03-05 16:51:55,466 [ERROR] from org.thp.scalligraph.utils.Retry in application-akka.actor.default-dispatcher-53 - uncaught error, not retrying
org.thp.scalligraph.NotFoundError: org.thp.thehive.models.User not found
        at org.thp.scalligraph.steps.StepsOps$TraversalOps.$anonfun$getOrFail$1(StepsOps.scala:287)
        at scala.Option.fold(Option.scala:251)
        at org.thp.scalligraph.steps.StepsOps$TraversalOps.getOrFail(StepsOps.scala:287)
        at org.thp.thehive.controllers.v1.UserCtrl.$anonfun$delete$3(UserCtrl.scala:110)
        at scala.util.Success.flatMap(Try.scala:251)
        at org.thp.thehive.controllers.v1.UserCtrl.$anonfun$delete$2(UserCtrl.scala:109)
        at org.thp.scalligraph.controllers.Entrypoint$EntryPointBuilder.$anonfun$authTransaction$2(Entrypoint.scala:77)
        at org.thp.scalligraph.janus.JanusDatabase.$anonfun$tryTransaction$10(JanusDatabase.scala:136)
        at scala.util.Try$.apply(Try.scala:213)
        at org.thp.scalligraph.janus.JanusDatabase.$anonfun$tryTransaction$8(JanusDatabase.scala:136)
        at scala.util.Try$.apply(Try.scala:213)
        at org.thp.scalligraph.utils.DelayRetry.withTry(Retry.scala:88)
        at org.thp.scalligraph.janus.JanusDatabase.tryTransaction(JanusDatabase.scala:130)
        at org.thp.scalligraph.controllers.Entrypoint$EntryPointBuilder.$anonfun$authTransaction$1(Entrypoint.scala:77)
        at org.thp.scalligraph.controllers.Entrypoint$EntryPointBuilder.$anonfun$auth$1(Entrypoint.scala:86)
        at org.thp.scalligraph.controllers.Entrypoint$EntryPointBuilder.$anonfun$asyncAuth$3(Entrypoint.scala:101)
        at org.scalactic.Good.fold(Or.scala:1229)
        at org.thp.scalligraph.controllers.Entrypoint$EntryPointBuilder.$anonfun$asyncAuth$2(Entrypoint.scala:101)
        at org.thp.scalligraph.DiagnosticContext$.$anonfun$withRequest$2(ContextPropagatingDisptacher.scala:100)
        at org.thp.scalligraph.DiagnosticContext$.saveDiagnosticContext(ContextPropagatingDisptacher.scala:107)
        at org.thp.scalligraph.DiagnosticContext$.withRequest(ContextPropagatingDisptacher.scala:98)
        at org.thp.scalligraph.controllers.Entrypoint$EntryPointBuilder.$anonfun$asyncAuth$1(Entrypoint.scala:101)
        at org.thp.scalligraph.auth.SessionAuthSrv$$anon$1.$anonfun$invokeBlock$2(SessionAuthSrv.scala:84)
        at scala.Option.fold(Option.scala:251)
        at org.thp.scalligraph.auth.SessionAuthSrv$$anon$1.invokeBlock(SessionAuthSrv.scala:82)
        at org.thp.scalligraph.auth.SessionAuthSrv$$anon$1.invokeBlock(SessionAuthSrv.scala:79)
        at play.api.mvc.ActionBuilder$$anon$10.$anonfun$invokeBlock$2(Action.scala:408)
        at play.api.mvc.ActionBuilderImpl.invokeBlock(Action.scala:441)
        at play.api.mvc.ActionBuilderImpl.invokeBlock(Action.scala:439)
        at play.api.mvc.ActionBuilder$$anon$10.invokeBlock(Action.scala:408)
        at play.api.mvc.ActionBuilder$$anon$10.invokeBlock(Action.scala:404)
        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:167)
        at scala.util.Try$.apply(Try.scala:213)
        at play.api.libs.streams.StrictAccumulator.$anonfun$mapFuture$3(Accumulator.scala:167)
        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:198)
        at play.core.server.AkkaHttpServer.$anonfun$runAction$4(AkkaHttpServer.scala:412)
        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:57)
        at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
        at org.thp.scalligraph.DiagnosticContext$.$anonfun$withDiagnosticContext$2(ContextPropagatingDisptacher.scala:92)
        at org.thp.scalligraph.DiagnosticContext$.saveDiagnosticContext(ContextPropagatingDisptacher.scala:107)
        at org.thp.scalligraph.DiagnosticContext$.withDiagnosticContext(ContextPropagatingDisptacher.scala:90)
        at org.thp.scalligraph.DiagnosticContext$$anon$2.withContext(ContextPropagatingDisptacher.scala:75)
        at org.thp.scalligraph.ContextPropagatingDisptacher$$anon$1.$anonfun$execute$1(ContextPropagatingDisptacher.scala:57)
        at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:47)
        at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(ForkJoinExecutorConfigurator.scala:47)
        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:157)
2020-03-05 16:51:55,466 [ERROR] from org.thp.scalligraph.models.Database in application-akka.actor.default-dispatcher-53 - Exception raised, rollback (org.thp.thehive.models.User not found)
2020-03-05 16:51:55,467 [WARN] from org.thp.scalligraph.ErrorHandler in application-akka.actor.default-dispatcher-53 - DELETE /api/v1/user/32856/force returned 404
org.thp.scalligraph.NotFoundError: org.thp.thehive.models.User not found
2020-03-05 16:51:55,467 [WARN] from org.thp.scalligraph.ErrorHandler in application-akka.actor.default-dispatcher-53 - DELETE /api/v1/user/32856/force returned 404
org.thp.scalligraph.NotFoundError: org.thp.thehive.models.User not found
        at org.thp.scalligraph.steps.StepsOps$TraversalOps.$anonfun$getOrFail$1(StepsOps.scala:287)
        at scala.Option.fold(Option.scala:251)
        at org.thp.scalligraph.steps.StepsOps$TraversalOps.getOrFail(StepsOps.scala:287)
        at org.thp.thehive.controllers.v1.UserCtrl.$anonfun$delete$3(UserCtrl.scala:110)
        at scala.util.Success.flatMap(Try.scala:251)
        at org.thp.thehive.controllers.v1.UserCtrl.$anonfun$delete$2(UserCtrl.scala:109)
        at org.thp.scalligraph.controllers.Entrypoint$EntryPointBuilder.$anonfun$authTransaction$2(Entrypoint.scala:77)
        at org.thp.scalligraph.janus.JanusDatabase.$anonfun$tryTransaction$10(JanusDatabase.scala:136)
        at scala.util.Try$.apply(Try.scala:213)
        at org.thp.scalligraph.janus.JanusDatabase.$anonfun$tryTransaction$8(JanusDatabase.scala:136)
        at scala.util.Try$.apply(Try.scala:213)
        at org.thp.scalligraph.utils.DelayRetry.withTry(Retry.scala:88)
        at org.thp.scalligraph.janus.JanusDatabase.tryTransaction(JanusDatabase.scala:130)
        at org.thp.scalligraph.controllers.Entrypoint$EntryPointBuilder.$anonfun$authTransaction$1(Entrypoint.scala:77)
        at org.thp.scalligraph.controllers.Entrypoint$EntryPointBuilder.$anonfun$auth$1(Entrypoint.scala:86)
        at org.thp.scalligraph.controllers.Entrypoint$EntryPointBuilder.$anonfun$asyncAuth$3(Entrypoint.scala:101)
        at org.scalactic.Good.fold(Or.scala:1229)
        at org.thp.scalligraph.controllers.Entrypoint$EntryPointBuilder.$anonfun$asyncAuth$2(Entrypoint.scala:101)
        at org.thp.scalligraph.DiagnosticContext$.$anonfun$withRequest$2(ContextPropagatingDisptacher.scala:100)
        at org.thp.scalligraph.DiagnosticContext$.saveDiagnosticContext(ContextPropagatingDisptacher.scala:107)
        at org.thp.scalligraph.DiagnosticContext$.withRequest(ContextPropagatingDisptacher.scala:98)
        at org.thp.scalligraph.controllers.Entrypoint$EntryPointBuilder.$anonfun$asyncAuth$1(Entrypoint.scala:101)
        at org.thp.scalligraph.auth.SessionAuthSrv$$anon$1.$anonfun$invokeBlock$2(SessionAuthSrv.scala:84)
        at scala.Option.fold(Option.scala:251)
        at org.thp.scalligraph.auth.SessionAuthSrv$$anon$1.invokeBlock(SessionAuthSrv.scala:82)
        at org.thp.scalligraph.auth.SessionAuthSrv$$anon$1.invokeBlock(SessionAuthSrv.scala:79)
        at play.api.mvc.ActionBuilder$$anon$10.$anonfun$invokeBlock$2(Action.scala:408)
        at play.api.mvc.ActionBuilderImpl.invokeBlock(Action.scala:441)
        at play.api.mvc.ActionBuilderImpl.invokeBlock(Action.scala:439)
        at play.api.mvc.ActionBuilder$$anon$10.invokeBlock(Action.scala:408)
        at play.api.mvc.ActionBuilder$$anon$10.invokeBlock(Action.scala:404)
        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:167)
        at scala.util.Try$.apply(Try.scala:213)
        at play.api.libs.streams.StrictAccumulator.$anonfun$mapFuture$3(Accumulator.scala:167)
        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:198)
        at play.core.server.AkkaHttpServer.$anonfun$runAction$4(AkkaHttpServer.scala:412)
        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:57)
        at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
        at org.thp.scalligraph.DiagnosticContext$.$anonfun$withDiagnosticContext$2(ContextPropagatingDisptacher.scala:92)
        at org.thp.scalligraph.DiagnosticContext$.saveDiagnosticContext(ContextPropagatingDisptacher.scala:107)
        at org.thp.scalligraph.DiagnosticContext$.withDiagnosticContext(ContextPropagatingDisptacher.scala:90)
        at org.thp.scalligraph.DiagnosticContext$$anon$2.withContext(ContextPropagatingDisptacher.scala:75)
        at org.thp.scalligraph.ContextPropagatingDisptacher$$anon$1.$anonfun$execute$1(ContextPropagatingDisptacher.scala:57)
        at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:47)
        at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(ForkJoinExecutorConfigurator.scala:47)
        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:157)
2020-03-05 16:51:55,467 [INFO] from org.thp.scalligraph.AccessLogFilter in application-akka.actor.default-dispatcher-53 - 127.0.0.1 DELETE /api/v1/user/32856/force took 58ms and returned 404 74 bytes
@Krypterya Krypterya added TheHive4 TheHive4 related issues bug labels Mar 5, 2020
@Krypterya
Copy link
Author

Deleting a user from the default admin Organisation works like a charm.

The issue seems to only impact user deletion from Organisations created manually

@To-om
Copy link
Contributor

To-om commented Mar 6, 2020

You can remove a user only if you are in the same organisation.
This restriction is not normal and will be removed.

@To-om
Copy link
Contributor

To-om commented Mar 6, 2020

@nadouani The DELETE /api/v1/user/$id/force API now accept an optional organisation name (in query string) which indicates on which organisation the user must be removed. If not present, the current admin organisation is used. This parameter is (only) required when a super admin want to remove a user in other organisation.

@Krypterya
Copy link
Author

@To-om Thank you for the feedback.

Kudos to the whole team on this release, and thank you for this project 👍

@To-om To-om added this to the 4.0.0-RC2 milestone Mar 11, 2020
@nadouani nadouani changed the title [Bug] Cannot Deleted user - Error "OrgUserCtrl: org.thp.thehive.models.User not found" Cannot Deleted user - Error "OrgUserCtrl: org.thp.thehive.models.User not found" Mar 17, 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

3 participants