{"action":"created","issue":{"url":"https://api.github.com/repos/moloch--/RootTheBox/issues/204","repository_url":"https://api.github.com/repos/moloch--/RootTheBox","labels_url":"https://api.github.com/repos/moloch--/RootTheBox/issues/204/labels{/name}","comments_url":"https://api.github.com/repos/moloch--/RootTheBox/issues/204/comments","events_url":"https://api.github.com/repos/moloch--/RootTheBox/issues/204/events","html_url":"https://github.com/moloch--/RootTheBox/issues/204","id":388214607,"node_id":"MDU6SXNzdWUzODgyMTQ2MDc=","number":204,"title":"Still Appear to have issues deleting multiple choice flag","user":{"login":"stealthsploit","id":26301152,"node_id":"MDQ6VXNlcjI2MzAxMTUy","avatar_url":"https://avatars2.githubusercontent.com/u/26301152?v=4","gravatar_id":"","url":"https://api.github.com/users/stealthsploit","html_url":"https://github.com/stealthsploit","followers_url":"https://api.github.com/users/stealthsploit/followers","following_url":"https://api.github.com/users/stealthsploit/following{/other_user}","gists_url":"https://api.github.com/users/stealthsploit/gists{/gist_id}","starred_url":"https://api.github.com/users/stealthsploit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stealthsploit/subscriptions","organizations_url":"https://api.github.com/users/stealthsploit/orgs","repos_url":"https://api.github.com/users/stealthsploit/repos","events_url":"https://api.github.com/users/stealthsploit/events{/privacy}","received_events_url":"https://api.github.com/users/stealthsploit/received_events","type":"User","site_admin":false},"labels":[{"id":1128312,"node_id":"MDU6TGFiZWwxMTI4MzEy","url":"https://api.github.com/repos/moloch--/RootTheBox/labels/bug","name":"bug","color":"fc2929","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-12-06T13:30:11Z","updated_at":"2018-12-07T07:57:45Z","closed_at":null,"author_association":"NONE","body":"I appreciate this issue was fixed elsewhere, and i've pulled the latest version, but I recently experienced this again when deleting a multiple choice flag.\r\n\r\n```\r\n[I 181206 13:27:34 AdminGameObjectHandlers:764] Deleted flag: Flag 3\r\n[E 181206 13:27:34 web:1670] Uncaught exception POST /admin/delete/flag (10.233.1.11)\r\n    HTTPServerRequest(protocol='http', host='10.133.255.3:1337', method='POST', uri='/admin/delete/flag', version='HTTP/1.1', remote_ip='10.233.1.11')\r\n    Traceback (most recent call last):\r\n      File \"/usr/local/lib/python2.7/dist-packages/tornado/web.py\", line 1590, in _execute\r\n        result = method(*self.path_args, **self.path_kwargs)\r\n      File \"/home/XXXXXXXXXX/RootTheBox/libs/SecurityDecorators.py\", line 63, in wrapper\r\n        return method(self, *args, **kwargs)\r\n      File \"/home/XXXXXXXXXX/RootTheBox/libs/SecurityDecorators.py\", line 38, in wrapper\r\n        return method(self, *args, **kwargs)\r\n      File \"/home/XXXXXXXXXX/RootTheBox/libs/SecurityDecorators.py\", line 93, in wrapper\r\n        return method(self, *args, **kwargs)\r\n      File \"/home/XXXXXXXXXX/RootTheBox/handlers/AdminHandlers/AdminGameObjectHandlers.py\", line 740, in post\r\n        uri[args[0]]()\r\n      File \"/home/XXXXXXXXXX/RootTheBox/handlers/AdminHandlers/AdminGameObjectHandlers.py\", line 766, in del_flag\r\n        self.dbsession.commit()\r\n      File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py\", line 954, in commit\r\n        self.transaction.commit()\r\n      File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py\", line 467, in commit\r\n        self._prepare_impl()\r\n      File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py\", line 447, in _prepare_impl\r\n        self.session.flush()\r\n      File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py\", line 2313, in flush\r\n        self._flush(objects)\r\n      File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py\", line 2440, in _flush\r\n        transaction.rollback(_capture_exception=True)\r\n      File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/util/langhelpers.py\", line 66, in __exit__\r\n        compat.reraise(exc_type, exc_value, exc_tb)\r\n      File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py\", line 2404, in _flush\r\n        flush_context.execute()\r\n      File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/unitofwork.py\", line 395, in execute\r\n        rec.execute(self)\r\n      File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/unitofwork.py\", line 597, in execute\r\n        uow\r\n      File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/persistence.py\", line 265, in delete_obj\r\n        cached_connections, mapper, table, delete)\r\n      File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/persistence.py\", line 1034, in _emit_delete_statements\r\n        c = connection.execute(statement, del_objects)\r\n      File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py\", line 948, in execute\r\n        return meth(self, multiparams, params)\r\n      File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/sql/elements.py\", line 269, in _execute_on_connection\r\n        return connection._execute_clauseelement(self, multiparams, params)\r\n      File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py\", line 1060, in _execute_clauseelement\r\n        compiled_sql, distilled_params\r\n      File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py\", line 1200, in _execute_context\r\n        context)\r\n      File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py\", line 1413, in _handle_dbapi_exception\r\n        exc_info\r\n      File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/util/compat.py\", line 265, in raise_from_cause\r\n        reraise(type(exception), exception, tb=exc_tb, cause=cause)\r\n      File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py\", line 1193, in _execute_context\r\n        context)\r\n      File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/default.py\", line 509, in do_execute\r\n        cursor.execute(statement, parameters)\r\n      File \"/usr/local/lib/python2.7/dist-packages/MySQLdb/cursors.py\", line 205, in execute\r\n        self.errorhandler(self, exc, value)\r\n      File \"/usr/local/lib/python2.7/dist-packages/MySQLdb/connections.py\", line 36, in defaulterrorhandler\r\n        raise errorclass, errorvalue\r\n    IntegrityError: (_mysql_exceptions.IntegrityError) (1451, 'Cannot delete or update a parent row: a foreign key constraint fails (`rootthebox`.`hint`, CONSTRAINT `hint_ibfk_2` FOREIGN KEY (`flag_id`) REFERENCES `flag` (`id`))') [SQL: u'DELETE FROM flag WHERE flag.id = %s'] [parameters: (43L,)] (Background on this error at: http://sqlalche.me/e/gkpj)\r\n[E 181206 13:27:34 BaseHandlers:192] Request from 10.233.1.11 resulted in an error code 500:\r\n    Traceback (most recent call last):\r\n      File \"/usr/local/lib/python2.7/dist-packages/tornado/web.py\", line 1590, in _execute\r\n        result = method(*self.path_args, **self.path_kwargs)\r\n      File \"/home/XXXXXXXXXX/RootTheBox/libs/SecurityDecorators.py\", line 63, in wrapper\r\n        return method(self, *args, **kwargs)\r\n      File \"/home/XXXXXXXXXX/RootTheBox/libs/SecurityDecorators.py\", line 38, in wrapper\r\n        return method(self, *args, **kwargs)\r\n      File \"/home/XXXXXXXXXX/RootTheBox/libs/SecurityDecorators.py\", line 93, in wrapper\r\n        return method(self, *args, **kwargs)\r\n      File \"/home/XXXXXXXXXX/RootTheBox/handlers/AdminHandlers/AdminGameObjectHandlers.py\", line 740, in post\r\n        uri[args[0]]()\r\n      File \"/home/XXXXXXXXXX/RootTheBox/handlers/AdminHandlers/AdminGameObjectHandlers.py\", line 766, in del_flag\r\n        self.dbsession.commit()\r\n      File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py\", line 954, in commit\r\n        self.transaction.commit()\r\n      File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py\", line 467, in commit\r\n        self._prepare_impl()\r\n      File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py\", line 447, in _prepare_impl\r\n        self.session.flush()\r\n      File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py\", line 2313, in flush\r\n        self._flush(objects)\r\n      File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py\", line 2440, in _flush\r\n        transaction.rollback(_capture_exception=True)\r\n      File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/util/langhelpers.py\", line 66, in __exit__\r\n        compat.reraise(exc_type, exc_value, exc_tb)\r\n      File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py\", line 2404, in _flush\r\n        flush_context.execute()\r\n      File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/unitofwork.py\", line 395, in execute\r\n        rec.execute(self)\r\n      File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/unitofwork.py\", line 597, in execute\r\n        uow\r\n      File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/persistence.py\", line 265, in delete_obj\r\n        cached_connections, mapper, table, delete)\r\n      File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/persistence.py\", line 1034, in _emit_delete_statements\r\n        c = connection.execute(statement, del_objects)\r\n      File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py\", line 948, in execute\r\n        return meth(self, multiparams, params)\r\n      File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/sql/elements.py\", line 269, in _execute_on_connection\r\n        return connection._execute_clauseelement(self, multiparams, params)\r\n      File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py\", line 1060, in _execute_clauseelement\r\n        compiled_sql, distilled_params\r\n      File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py\", line 1200, in _execute_context\r\n        context)\r\n      File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py\", line 1413, in _handle_dbapi_exception\r\n        exc_info\r\n      File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/util/compat.py\", line 265, in raise_from_cause\r\n        reraise(type(exception), exception, tb=exc_tb, cause=cause)\r\n      File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py\", line 1193, in _execute_context\r\n        context)\r\n      File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/default.py\", line 509, in do_execute\r\n        cursor.execute(statement, parameters)\r\n      File \"/usr/local/lib/python2.7/dist-packages/MySQLdb/cursors.py\", line 205, in execute\r\n        self.errorhandler(self, exc, value)\r\n      File \"/usr/local/lib/python2.7/dist-packages/MySQLdb/connections.py\", line 36, in defaulterrorhandler\r\n        raise errorclass, errorvalue\r\n    IntegrityError: (_mysql_exceptions.IntegrityError) (1451, 'Cannot delete or update a parent row: a foreign key constraint fails (`rootthebox`.`hint`, CONSTRAINT `hint_ibfk_2` FOREIGN KEY (`flag_id`) REFERENCES `flag` (`id`))') [SQL: u'DELETE FROM flag WHERE flag.id = %s'] [parameters: (43L,)] (Background on this error at: http://sqlalche.me/e/gkpj)\r\n\r\n[E 181206 13:27:34 BaseHandlers:87] Failed call to get_current_user()\r\n    Traceback (most recent call last):\r\n      File \"/home/XXXXXXXXXX/RootTheBox/handlers/BaseHandlers.py\", line 83, in get_current_user\r\n        return User.by_uuid(self.session['user_uuid'])\r\n      File \"/home/XXXXXXXXXX/RootTheBox/models/User.py\", line 134, in by_uuid\r\n        return dbsession.query(cls).filter_by(uuid=unicode(_uuid)).first()\r\n      File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/query.py\", line 2895, in first\r\n        ret = list(self[0:1])\r\n      File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/query.py\", line 2687, in __getitem__\r\n        return list(res)\r\n      File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/query.py\", line 2995, in __iter__\r\n        return self._execute_and_instances(context)\r\n      File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/query.py\", line 3016, in _execute_and_instances\r\n        close_with_result=True)\r\n      File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/query.py\", line 3025, in _get_bind_args\r\n        **kw\r\n      File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/query.py\", line 3007, in _connection_from_session\r\n        conn = self.session.connection(**kw)\r\n      File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py\", line 1046, in connection\r\n        execution_options=execution_options)\r\n      File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py\", line 1051, in _connection_for_bind\r\n        engine, execution_options)\r\n      File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py\", line 388, in _connection_for_bind\r\n        self._assert_active()\r\n      File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py\", line 276, in _assert_active\r\n        % self._rollback_exception\r\n    InvalidRequestError: This Session's transaction has been rolled back due to a previous exception during flush. To begin a new transaction with this Session, first issue Session.rollback(). Original exception was: (_mysql_exceptions.IntegrityError) (1451, 'Cannot delete or update a parent row: a foreign key constraint fails (`rootthebox`.`hint`, CONSTRAINT `hint_ibfk_2` FOREIGN KEY (`flag_id`) REFERENCES `flag` (`id`))') [SQL: u'DELETE FROM flag WHERE flag.id = %s'] [parameters: (43L,)] (Background on this error at: http://sqlalche.me/e/gkpj)\r\n[E 181206 13:27:34 web:1114] Uncaught exception in write_error\r\n    Traceback (most recent call last):\r\n      File \"/usr/local/lib/python2.7/dist-packages/tornado/web.py\", line 1112, in send_error\r\n        self.write_error(status_code, **kwargs)\r\n      File \"/home/XXXXXXXXXX/RootTheBox/handlers/BaseHandlers.py\", line 202, in write_error\r\n        self.render('public/404.html')\r\n      File \"/usr/local/lib/python2.7/dist-packages/tornado/web.py\", line 766, in render\r\n        html = self.render_string(template_name, **kwargs)\r\n      File \"/usr/local/lib/python2.7/dist-packages/tornado/web.py\", line 907, in render_string\r\n        return t.generate(**namespace)\r\n      File \"/usr/local/lib/python2.7/dist-packages/tornado/template.py\", line 346, in generate\r\n        return execute()\r\n      File \"public/404_html.generated.py\", line 14, in _tt_execute\r\n        _tt_tmp = _tt_modules.Menu()  # main.html:29\r\n      File \"/usr/local/lib/python2.7/dist-packages/tornado/web.py\", line 1678, in render\r\n        rendered = self._active_modules[name].render(*args, **kwargs)\r\n      File \"/home/XXXXXXXXXX/RootTheBox/modules/Menu.py\", line 35, in render\r\n        user = User.by_id(self.handler.session['user_id'])\r\n      File \"/home/XXXXXXXXXX/RootTheBox/models/User.py\", line 129, in by_id\r\n        return dbsession.query(cls).filter_by(id=_id).first()\r\n      File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/query.py\", line 2895, in first\r\n        ret = list(self[0:1])\r\n      File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/query.py\", line 2687, in __getitem__\r\n        return list(res)\r\n      File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/query.py\", line 2995, in __iter__\r\n        return self._execute_and_instances(context)\r\n      File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/query.py\", line 3016, in _execute_and_instances\r\n        close_with_result=True)\r\n      File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/query.py\", line 3025, in _get_bind_args\r\n        **kw\r\n      File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/query.py\", line 3007, in _connection_from_session\r\n        conn = self.session.connection(**kw)\r\n      File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py\", line 1046, in connection\r\n        execution_options=execution_options)\r\n      File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py\", line 1051, in _connection_for_bind\r\n        engine, execution_options)\r\n      File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py\", line 388, in _connection_for_bind\r\n        self._assert_active()\r\n      File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py\", line 276, in _assert_active\r\n        % self._rollback_exception\r\n    InvalidRequestError: This Session's transaction has been rolled back due to a previous exception during flush. To begin a new transaction with this Session, first issue Session.rollback(). Original exception was: (_mysql_exceptions.IntegrityError) (1451, 'Cannot delete or update a parent row: a foreign key constraint fails (`rootthebox`.`hint`, CONSTRAINT `hint_ibfk_2` FOREIGN KEY (`flag_id`) REFERENCES `flag` (`id`))') [SQL: u'DELETE FROM flag WHERE flag.id = %s'] [parameters: (43L,)] (Background on this error at: http://sqlalche.me/e/gkpj)\r\n[E 181206 13:27:34 web:2162] 500 POST /admin/delete/flag (10.233.1.11) 141.86ms\r\n```"},"comment":{"url":"https://api.github.com/repos/moloch--/RootTheBox/issues/comments/445152526","html_url":"https://github.com/moloch--/RootTheBox/issues/204#issuecomment-445152526","issue_url":"https://api.github.com/repos/moloch--/RootTheBox/issues/204","id":445152526,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0NTE1MjUyNg==","user":{"login":"stealthsploit","id":26301152,"node_id":"MDQ6VXNlcjI2MzAxMTUy","avatar_url":"https://avatars2.githubusercontent.com/u/26301152?v=4","gravatar_id":"","url":"https://api.github.com/users/stealthsploit","html_url":"https://github.com/stealthsploit","followers_url":"https://api.github.com/users/stealthsploit/followers","following_url":"https://api.github.com/users/stealthsploit/following{/other_user}","gists_url":"https://api.github.com/users/stealthsploit/gists{/gist_id}","starred_url":"https://api.github.com/users/stealthsploit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stealthsploit/subscriptions","organizations_url":"https://api.github.com/users/stealthsploit/orgs","repos_url":"https://api.github.com/users/stealthsploit/repos","events_url":"https://api.github.com/users/stealthsploit/events{/privacy}","received_events_url":"https://api.github.com/users/stealthsploit/received_events","type":"User","site_admin":false},"created_at":"2018-12-07T07:57:45Z","updated_at":"2018-12-07T07:57:45Z","author_association":"NONE","body":"Worked perfectly, appreciate the work."}}
{"actor":{"display_login":"stealthsploit"}}