dfir-iris / iris-web

Collaborative Incident Response platform
GNU Lesser General Public License v3.0
1.08k stars 185 forks source link

[BUG] Cases with tasks including comments can't be deleted #488

Open StaSys846 opened 5 months ago

StaSys846 commented 5 months ago

Describe the bug Deletion of a case is not possible when comments (for any case item) are present in the case. On deletion via "case management" in WebGUI all case related objects are deleted, but the case itself remains. Log error says:

sqlalchemy.exc.IntegrityError: (psycopg2.errors.ForeignKeyViolation) update or delete on table "cases" violates foreign key constraint "comments_comment_case_id_fkey" on table "comments"
DETAIL:  Key (case_id)=(xxx) is still referenced from table "comments".

To Reproduce Steps to reproduce the behavior:

  1. Create a new case
  2. add an element to the case (e.g. asset / IOC)
  3. Add an comment to the new element
  4. Go to: Case Management
  5. Select the newly created case
  6. Open the case and click "Delete case"
  7. An Error message will appear image

Expected behavior With deletion of the case all case related objects should be deleted/removed inclusively the case itself.

Desktop (please complete the following information):

PurplePetrus commented 3 months ago

Just encountered the same issue while testing. @StaSys846 Thanks for the workaround