opencti icon indicating copy to clipboard operation
opencti copied to clipboard

Already deleted error when cascade deleting in report

Open JeremyCloarec opened this issue 1 year ago • 1 comments

Description

When deleting a report choosing the cascade delete option, we sometimes get an Already deleted error. This is due to a bug in the cascade delete of the report: we try to delete all orphan elements concurrently, relations included. However, relations are sometimes already deleted when the report tries to delete them, because it was deleted during the deletion of the source or target entity. Cascade delete algorithm in report needs to be improved

Environment

  1. OS (where OpenCTI server runs): { e.g. Mac OS 10, Windows 10, Ubuntu 16.4, etc. }
  2. OpenCTI version: { e.g. OpenCTI 1.0.2 }
  3. OpenCTI client: { e.g. frontend or python }
  4. Other environment details:

Reproducible Steps

Steps to create the smallest reproducible scenario:

  1. Create a report
  2. Add multiple orphan entities to the report (5-6 entities should be enough)
  3. Create multiple relationships between those entities (10-12 relationships should be enough)
  4. Delete the report choosing the cascade delete option

Expected Output

The report and the entities being deleted

Actual Output

An "Already deleted" error is thrown and the report is not deleted

Additional information

Screenshots (optional)

JeremyCloarec avatar May 03 '24 08:05 JeremyCloarec

can be reproduced here https://testing.octi.staging.filigran.io/dashboard/analyses/reports/de981984-2576-4275-a6d7-ccac73c2269d

jborozco avatar May 06 '24 07:05 jborozco