TheHive-Project / TheHive

TheHive: a Scalable, Open Source and Free Security Incident Response Platform
https://thehive-project.org
GNU Affero General Public License v3.0
3.3k stars 609 forks source link

[Bug] TheHive 4.0.4 cannot show tasks created in previous versions #1763

Closed albertogordillo closed 3 years ago

albertogordillo commented 3 years ago

Request Type

Bug

Work Environment

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

Problem Description

After upgrading from TheHive 4.0.2 to 4.0.4 all the case tasks created in previous versions are no longer showed in the web interface. It shows that there are tasks (e.g. "Tasks List (0 of 12)") but are not showed.

application.log shows an error related to "actionRequired"

[ERROR] from akka.actor.ActorSystemImpl in application-akka.actor.default-dispatcher-32 [|] Response stream for [POST /api/v1/query] failed with 'The provided traverser does not map to a value: v[2703540376]->[JanusGraphVertexStep(IN,[ShareTask],edge), TraversalFilterStep([EdgeVertexStep(OUT), JanusGraphVertexStep(IN,[OrganisationShare],vertex), NoOpBarrierStep(2500), HasStep([~id.eq(4152)])]), JanusGraphPropertiesStep([actionRequired],value)]'. Aborting connection.
java.lang.IllegalArgumentException: The provided traverser does not map to a value: v[2703540376]->[JanusGraphVertexStep(IN,[ShareTask],edge), TraversalFilterStep([EdgeVertexStep(OUT), JanusGraphVertexStep(IN,[OrganisationShare],vertex), NoOpBarrierStep(2500), HasStep([~id.eq(4152)])]), JanusGraphPropertiesStep([actionRequired],value)]
        at org.apache.tinkerpop.gremlin.process.traversal.util.TraversalUtil.apply(TraversalUtil.java:46)

I have been able to get the tasks via API removing "actionRequired" from the query. Instead of:

curl -XPOST -H 'Authorization: Bearer xxxxxxxxx' -H 'Content-Type: application/json' http://127.0.0.1:9000/api/v1/query?name=case-tasks -d '{"query":[{"_name":"getCase","idOrName":"~2990170120"},{"_name":"tasks"},{"_name":"filter","_not":{"_field":"status","_value":"Cancel"}},{"_name":"sort","_fields":[{"flag":"desc"},{"order":"asc"},{"startDate":"asc"},{"title":"asc"}]},{"_name":"page","from":0,"to":15,"extraData":["shareCount","actionRequired"]}]}'

This query works

curl -XPOST -H 'Authorization: Bearer xxxxxxxxx' -H 'Content-Type: application/json' http://127.0.0.1:9000/api/v1/query?name=case-tasks -d '{"query":[{"_name":"getCase","idOrName":"~2990170120"},{"_name":"tasks"},{"_name":"filter","_not":{"_field":"status","_value":"Cancel"}},{"_name":"sort","_fields":[{"flag":"desc"},{"order":"asc"},{"startDate":"asc"},{"title":"asc"}]},{"_name":"page","from":0,"to":15,"extraData":["shareCount"]}]}'

It seems that tasks created in previous versions does not have the "actionRequired" field that is a feature of TheHive 4.0.4.

Steps to Reproduce

  1. Create some tasks in TheHive 4.0.2
  2. Upgrade to TheHive 4.0.4
  3. Try to view these tasks in the web interface

Possible Solutions

I guess that the solution is upgrade all the tasks to v4.0.4 (adding the field "actionRequired") or modify the task methods to support legacy tasks.

nadouani commented 3 years ago

@rriclet could you please take a look at this one? Thanks

To-om commented 3 years ago

This problem appears when database schema is not correctly updated. This commit should fix it.

albertogordillo commented 3 years ago

Hello To-om,

After upgrading to 4.0.5 the problem is still present. Do I have to do anything manually to update database schema?

Regards

stacsirt commented 3 years ago

Hi,

This still appears to be an issue. We're experiencing it too.

Regards

nulltiply commented 3 years ago

Also experiencing this issue. Task logs created after the update show up but old ones do not.

rriclet commented 3 years ago

https://github.com/TheHive-Project/TheHive/issues/1875

birigli commented 3 years ago

Hi, is it sure the issue #1875 has the same roots? There the problem is with the tasklogs, and the initial version is already 4.0.5, finally there is not any error in application.log.

Regards

asamrega commented 2 years ago

Hello!

@albertogordillo, have you managed to solve the problem?