TheHive-Project / TheHive-Project/Cortex
[BUG] Unable to remove last element in settings list
Nobody has claimed this yet.
- Dominant language
- Scala
- Stars
- 1.6k
- Forks
- 264
- PR merge metrics
- No merged PRs in 30d
Description
Unable to remove last element in settings list
Request Type
Bug
Work Environment
| Question | Answer |
|---|---|
| OS version (server) | Docker image: thehiveproject/cortex:3.0.1 |
| OS version (client) | Windows 10 |
| Cortex version / git hash | 3.01.x, hash of the commit |
| Package Type | Docker |
| Browser type & version | Edge Chromium |
Problem Description
Disclaimer: I can't test 3.1.0-1 since the migration of my DB fails, but this problem does not seem to have been reported.
It is not possible to remove the last item in a settings list (i.e. an item with "multi": true):

This is not only a UI bug, since this propagates down to e.g. Cortex Analyzers. One would expect to receive a empty list (or at least a None for the list itself) if no items are configured. Instead, Cortex creates a list with a None object in position 0 ([None]).
Steps to Reproduce
- Create a Analyzer config JSON with multi = true and required = false
- Create an instance of the config in Cortex
- Try to remove the last item of the configuration
- If you run it in debug or print it out, you will see a list that contains a None element
Possible Solutions
- Let users remove the last element in a list via the UI
- If no element are present, return an actual empty list
- If an empty string is present in a multi input field, actually pass it on as empty string, not as None (i.e.
[""]instead of[None])
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the settings list behavior for configurations marked multi=true and required=false, then trace how an empty configuration is passed to Cortex Analyzers. Reproduce the final-item removal case from the listed steps and verify that no configured items produce an empty list rather than [None].
Written by the indexing model from the issue text.
Assessment
- Tech stack
- scala
- Domain
- backend, frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100