Closed mssalvatore closed 10 months ago
Probably because oneOf needs properties first
First example same as above:
Then rsjf playground example:
{
"type": "object",
"oneOf": [
{
"properties": {
"lorem": {
"type": "string"
}
},
"required": [
"lorem"
]
},
{
"properties": {
"ipsum": {
"type": "string"
}
},
"required": [
"ipsum"
]
}
]
}
By rjsf documentation is exactly what I thought. Built a mock plugin with the above example and. everything seems fine. The configuration:
Mock plugin config schema: config-schema.json
Note: Filling the values from one and changing the option DOESN'T keep the state of the values. That makes sense because it is oneOf which means we can choose only one option out of many.
PoC:
https://github.com/guardicore/monkey/assets/15820737/6352320b-1a35-4b1f-bed4-a3f39ed8feab
Awesome!
Spike
Objective
Allow mutually exclusive groups of options to be configured for plugins
Background
Certain plugins may want to allow users to configure mutually exclusive groups of options. For example, a data exfiltration payload may allow the user to exfiltrate data to an S3 bucket, tunneled over DNS, via SCP, or via any number of other mechanisms. Each of these mechanisms will have a different set of options to configure it. Ideally, when configuring the plugin, the user can select one, and only one, of these options and then configure it as appropriate.
Output
A plan/issue for any necessary modifications that need to be made, or documentation that explains how to accomplish this goal in the current system.
Starting point
The
oneOf
JSON schema keyword can be used to accomplish this in the current system with one problem: It appears as though the UI autofills fields, resulting in multiple options being configured. See the below configuration and GIF for more details: