{"action":"opened","issue":{"url":"https://api.github.com/repos/yeti-platform/yeti/issues/157","repository_url":"https://api.github.com/repos/yeti-platform/yeti","labels_url":"https://api.github.com/repos/yeti-platform/yeti/issues/157/labels{/name}","comments_url":"https://api.github.com/repos/yeti-platform/yeti/issues/157/comments","events_url":"https://api.github.com/repos/yeti-platform/yeti/issues/157/events","html_url":"https://github.com/yeti-platform/yeti/issues/157","id":270415936,"number":157,"title":"Remove references to observable when it is deleted","user":{"login":"tomchop","id":1257972,"avatar_url":"https://avatars3.githubusercontent.com/u/1257972?v=4","gravatar_id":"","url":"https://api.github.com/users/tomchop","html_url":"https://github.com/tomchop","followers_url":"https://api.github.com/users/tomchop/followers","following_url":"https://api.github.com/users/tomchop/following{/other_user}","gists_url":"https://api.github.com/users/tomchop/gists{/gist_id}","starred_url":"https://api.github.com/users/tomchop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomchop/subscriptions","organizations_url":"https://api.github.com/users/tomchop/orgs","repos_url":"https://api.github.com/users/tomchop/repos","events_url":"https://api.github.com/users/tomchop/events{/privacy}","received_events_url":"https://api.github.com/users/tomchop/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-11-01T19:02:59Z","updated_at":"2017-11-01T19:02:59Z","closed_at":null,"author_association":"COLLABORATOR","body":"### Description\r\nInvestigations contain empty DBRefs when an observable is deleted from the database, provoking all kinds of problems.\r\n\r\n### Environment\r\n\r\n| Question         | Answer\r\n|------------------|--------------------\r\n| Git commit       | HEAD\r\n| OS version       | 10.12.6\r\n| Browser          | Chrome 61.0.3163.100\r\n\r\n### Steps to Reproduce\r\n1. Add two Observables to the database\r\n2. Create an investigation, add the two observables to it\r\n3. Delete one of the nodes from the database or via mongoengine's `delete()` function\r\n4. Try to load the investigation\r\n\r\n#### Expected behavior\r\nInvestigation and nodes load\r\n\r\n#### Actual behavior\r\nInvestigation doesn't load, request 500's. In `core/investigation.py` L63, it complains about one of the nodes not having a `to_mongo` attribute.\r\n\r\nI think this can be fixed by adding a [delete rule](http://docs.mongoengine.org/guide/defining-documents.html#dealing-with-deletion-of-referred-documents) in the `Investigation` model definition, but I'll leave this up to you in case you want to take any other actions on the investigation itself."}}
{"actor":{"display_login":"tomchop"}}