moloch-- / RootTheBox

A Game of Hackers (CTF Scoreboard & Game Manager)
http://root-the-box.com/
Apache License 2.0
908 stars 292 forks source link

Glitch - can't edit flags #565

Closed PJNorrisS1 closed 1 year ago

PJNorrisS1 commented 1 year ago

One of our admins was doing some work on one of the boxes yesterday. He can log in as admin, but when editing a flag, this comes up: image

The URL is /admin/view/game_objects

Restarted container, not fix. Restore the XML file from previous export.

And from the console we see this:

[E 230531 07:44:54 web:1871] Uncaught exception GET /admin/view/game_objects (86.xxx)
cloud-yoda-webapp-1     |     HTTPServerRequest(protocol='https', host='yoda.xxxxx', method='GET', uri='/admin/view/game_objects', version='HTTP/1.1', remote_ip='86xxx')
cloud-yoda-webapp-1     |     Traceback (most recent call last):
cloud-yoda-webapp-1     |       File "/usr/local/lib/python3.8/site-packages/tornado/web.py", line 1784, in _execute
cloud-yoda-webapp-1     |         result = method(*self.path_args, **self.path_kwargs)
cloud-yoda-webapp-1     |       File "/opt/rtb/libs/SecurityDecorators.py", line 91, in wrapper
cloud-yoda-webapp-1     |         return method(self, *args, **kwargs)
cloud-yoda-webapp-1     |       File "/opt/rtb/libs/SecurityDecorators.py", line 46, in wrapper
cloud-yoda-webapp-1     |         return method(self, *args, **kwargs)
cloud-yoda-webapp-1     |       File "/opt/rtb/libs/SecurityDecorators.py", line 130, in wrapper
cloud-yoda-webapp-1     |         return method(self, *args, **kwargs)
cloud-yoda-webapp-1     |       File "/opt/rtb/handlers/AdminHandlers/AdminGameObjectHandlers.py", line 401, in get
cloud-yoda-webapp-1     |         self.render(uri[args[0]], errors=None, success=None)
cloud-yoda-webapp-1     |       File "/usr/local/lib/python3.8/site-packages/tornado/web.py", line 940, in render
cloud-yoda-webapp-1     |         html = self.render_string(template_name, **kwargs)
cloud-yoda-webapp-1     |       File "/usr/local/lib/python3.8/site-packages/tornado/web.py", line 1089, in render_string
cloud-yoda-webapp-1     |         return t.generate(**namespace)
cloud-yoda-webapp-1     |       File "/usr/local/lib/python3.8/site-packages/tornado/template.py", line 362, in generate
cloud-yoda-webapp-1     |         return execute()
cloud-yoda-webapp-1     |       File "admin/view/game_objects_html.generated.py", line 1476, in _tt_execute
cloud-yoda-webapp-1     |         _tt_tmp = Flag.by_id(flag.lock_id).name  # admin/view/game_objects.html:857 (via main.html:32)
cloud-yoda-webapp-1     |     AttributeError: 'NoneType' object has no attribute 'name'
cloud-yoda-webapp-1     | [E 230531 07:44:54 BaseHandlers:195] Request from 86.xxx resulted in an error code 500:
cloud-yoda-webapp-1     |     Traceback (most recent call last):
cloud-yoda-webapp-1     |       File "/usr/local/lib/python3.8/site-packages/tornado/web.py", line 1784, in _execute
cloud-yoda-webapp-1     |         result = method(*self.path_args, **self.path_kwargs)
cloud-yoda-webapp-1     |       File "/opt/rtb/libs/SecurityDecorators.py", line 91, in wrapper
cloud-yoda-webapp-1     |         return method(self, *args, **kwargs)
cloud-yoda-webapp-1     |       File "/opt/rtb/libs/SecurityDecorators.py", line 46, in wrapper
cloud-yoda-webapp-1     |         return method(self, *args, **kwargs)
cloud-yoda-webapp-1     |       File "/opt/rtb/libs/SecurityDecorators.py", line 130, in wrapper
cloud-yoda-webapp-1     |         return method(self, *args, **kwargs)
cloud-yoda-webapp-1     |       File "/opt/rtb/handlers/AdminHandlers/AdminGameObjectHandlers.py", line 401, in get
cloud-yoda-webapp-1     |         self.render(uri[args[0]], errors=None, success=None)
cloud-yoda-webapp-1     |       File "/usr/local/lib/python3.8/site-packages/tornado/web.py", line 940, in render
cloud-yoda-webapp-1     |         html = self.render_string(template_name, **kwargs)
cloud-yoda-webapp-1     |       File "/usr/local/lib/python3.8/site-packages/tornado/web.py", line 1089, in render_string
cloud-yoda-webapp-1     |         return t.generate(**namespace)
cloud-yoda-webapp-1     |       File "/usr/local/lib/python3.8/site-packages/tornado/template.py", line 362, in generate
cloud-yoda-webapp-1     |         return execute()
cloud-yoda-webapp-1     |       File "admin/view/game_objects_html.generated.py", line 1476, in _tt_execute
cloud-yoda-webapp-1     |         _tt_tmp = Flag.by_id(flag.lock_id).name  # admin/view/game_objects.html:857 (via main.html:32)
cloud-yoda-webapp-1     |     AttributeError: 'NoneType' object has no attribute 'name'
cloud-yoda-webapp-1     |     
cloud-yoda-webapp-1     | [E 230531 07:44:54 web:2344] 500 GET /admin/view/game_objects (86.xxx) 242.40ms
cloud-yoda-webapp-1     | [I 230531 07:44:55 web:2344] 101 GET /connect/notifications/updates (86.xxx) 0.56ms
PJNorrisS1 commented 1 year ago

UPDATE: Able to recreate this. From a fresh database of a working model, I just deleted a flag, and the glitch came up

eljeffeg commented 1 year ago

This would seem to occur if you delete a flag that is being used to lock another flag. You think we should we remove the lock automatically or return a fail until the lock is resolved?

PJNorrisS1 commented 1 year ago

Return a fail until the lock is resolved is my vote, as long as there is a notification clearly states, unable to delete, dependent on a lock or something.

PJNorrisS1 commented 1 year ago

Do you have an ETA when this will be fixed? Thank you!

eljeffeg commented 1 year ago

I pushed up a fix for this.. let me know if it doesn't resolve the issue and we can reopen.

eljeffeg commented 1 year ago

Just thought that I need to add some code when you delete a box that has flag locks within the box. Will update soon.