Skip to content

Commit

Permalink
Merge pull request #447 from TheHive-Project/CTX-16-too-many-scroll-c…
Browse files Browse the repository at this point in the history
…ontexts-are-created-when-cortex-is-loaded

[CTX-16] fix: don't use Elasticsearch scroll to find user by its API key
  • Loading branch information
To-om authored Jul 12, 2023
2 parents 0121acd + 7a3d9f4 commit 8a09b5c
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions app/org/thp/cortex/services/KeyAuthSrv.scala
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ class KeyAuthSrv @Inject() (userSrv: UserSrv, implicit val ec: ExecutionContext,
import org.elastic4play.services.QueryDSL._
// key attribute is sensitive so it is not possible to search on that field
userSrv
.find("status" ~= "Ok", Some("all"), Nil)
.find(and("status" ~= "Ok", "key" ~= key), Some("0-1"), Nil)
._1
.filter(_.key().contains(key))
.runWith(Sink.headOption)
.flatMap {
case Some(user) => userSrv.getFromUser(request, user, name)
Expand Down

0 comments on commit 8a09b5c

Please sign in to comment.