TheHive-Project / TheHive-Project/Cortex

[BUG] Unable to remove last element in settings list

Open
#328 0 comments 0 reactions 0 assignees View on GitHub

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):
settings_item

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
  1. Create a Analyzer config JSON with multi = true and required = false
  2. Create an instance of the config in Cortex
  3. Try to remove the last item of the configuration
  4. If you run it in debug or print it out, you will see a list that contains a None element
Possible Solutions
  1. Let users remove the last element in a list via the UI
  2. If no element are present, return an actual empty list
  3. 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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.