-
Notifications
You must be signed in to change notification settings - Fork 807
Description
Describe the bug
The user is asked to submit configuration if they open the "Network" or "Ransomware" tab, even if they make no changes to the configuration, while changing configuration tabs.
To Reproduce
Steps to reproduce the behavior:
- Run the Island.
- Go to the configuration page.
- Click on the "Network" or "Ransomware" tab.
- Click on the "ATT&CK" tab.
- See the pop-up asking you to submit your changes (even though you made none).
Expected behavior
It should not show the pop-up if no config changes were made.
Screenshots
island-config-info-box-bug.mp4
Findings
This happens because of the info box and README note in the "Network" and "Ransomware".
The following line resolves to false which is why the Island thinks the config has changed. This happens because this.state.configuration
contains the info_box
and readme
fields, but this.initialConfig
does not.
if (JSON.stringify(this.state.configuration) === JSON.stringify(this.initialConfig)) { |
My guess is that this has something to do with the fact that in the schema, info_box
and readme
are of type object
but have no properties
, which all other objects do.
If my guess is correct, a quick hack would be to change the type to string
(or some other field type). We're already overriding the component (see code snippet below), so it won't show the input field. However, by my experimentation, input field types must have a title. I can't leave it blank and if I don't define it, it picks up the key value. It's possible to just define it as one whitespace but that leaves an awkward gap in the UI.
monkey/monkey/monkey_island/cc/ui/src/components/configuration-components/UiSchema.js
Line 21 in a77b7ea
'ui:field': InfoBox |
What to try next: One thing that I didn't spend a lot of time on was understanding the difference between custom widgets and custom fields. Maybe there's a workaround there. Also see this comment.
(All screenshots and code snippets are only about the "Network" tab.)
Note
If you click "Reset to defaults", you can then go back to the Attack config screen without getting a warning. After switching to the Attack config screen, you cannot go to any other tab until you refresh
Tasks
- Fix it. (1.25d) @ilija-lazoroski