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

Editing a flag - lose the dependency #585

Closed PJNorrisS1 closed 1 month ago

PJNorrisS1 commented 11 months ago

A Frustrating issue where we are editing flags. On most occasions it will not load the flag dependency, so when we save the flag, we lose the dependency. 9/10 it's repeatable. On occasion it will populate. There is nothing specific... all types of flag and also brand new flags and old flags...

eljeffeg commented 11 months ago

I'm not able to repeat that one. Perhaps when you're able to reproduce it, open the web developer panel and see if there are any errors or something. I'll need a little more info.

PJNorrisS1 commented 11 months ago

There is nothing in the docker logs; nothing that appears erroneous in the console developer panel. I recorded a short screen video of what I'm experiencing. In the video, I'm editing the same flag. There is a dependency on the flag; but you will see - I open and close the same flag, then a couple of times, the dependency appears. There is no pattern! https://vimeo.com/864657574/df019998db?share=copy

bmartin5692 commented 11 months ago

I'm seeing the following for a bit of extra detail to add on to PJ's video:

eljeffeg commented 11 months ago

It looks like it could be a javascript issue with static/js/pages/admin/view/game_objects.js. This is the code that should set the option as selected. https://github.com/moloch--/RootTheBox/blob/286d709002b86d3660a6a7a908172f65daa10387/static/js/pages/admin/view/game_objects.js#L47-L52

I still haven't been able to reproduce it here. What browser are you using? What I'd suggest is adding a console.log after line 5 to print out the (key, value) to the console. Add a console.log after line 47 to see if it triggers and try to understand what is not happening there. You could also do this via the browser dev by adding a break point and reviewing the vars but I tend to like seeing it printed out and printing out the logic... If you can track it down there, I'm happy to update.

PJNorrisS1 commented 11 months ago

This is bizarre. I have added the console logs at line 48

image

Which is correct and value exists.

The entry does not appear in the GUI though. This can't be a GUI issue, as if I save the flag entry, then it clears the lock_uuid field and I have to re-edit and find the flag dependency.

If I step through the script with break points, the value appears to populate.

I have tested on both Chrome and Safari. Logs from Safari.

PJNorrisS1 commented 5 months ago

This is still an issue we see on a highly regular basis. 80% of the time editing the flag, the dependency value disappears; 20% it remains and stays. I can reproduce this regularly on the db's we are using. Wondering if there is a timeout when querying the data, is being hit somewhere?