-
Notifications
You must be signed in to change notification settings - Fork 6
Description
What happened?
When using the challenge update page in the CTFd UI (https://xxx/admin/challenge/<id_challenge>) to remove a timeout, the plugin fails to process the change and retains the current value. This is due to the behavior of the UI and the form submitted by the plugin, which will look like this:
{
...
"timeout": "",
...
}During creation, the submitted empty value is ignored and set to NULL in the database. However, during an update, the submitted empty value is also ignored, and the value is not updated.
This behavior is explained by the following code snippet:
Lines 285 to 301 in 5a5ac4d
| for key in list(data.keys()): # use list(data.keys()) to prevent RuntimeError | |
| if ( | |
| key | |
| in [ | |
| "additional", | |
| "mana_cost", | |
| "until", | |
| "timeout", | |
| "shared", | |
| "destroy_on_flag", | |
| "scenario", | |
| "min", | |
| "max", | |
| ] | |
| and data[key] == "" | |
| ): | |
| data.pop(key) |
The issue was not detected earlier because we use the plugin's API via the Terraform provider or the Pulumi provider.
poke @pandatix
What you expected
As admin, I can update all the attributes from front UI.
scope
Front
docker-image
No
Version
CTFd 3.8.1 CTFd-chall-manager 0.9.0 chall-manager : 0.6.x
Relevant log output
Code of Conduct
- I agree to follow this project's Code of Conduct