Project

General

Profile

Actions

Bug #26075

open

Trying to save a group with empty criteria removes all entries

Added by Elaad FURREEDAN 6 days ago. Updated 2 days ago.

Status:
Pending technical review
Priority:
1 (highest)
Category:
Web - UI & UX
Target version:
Severity:
Major - prevents use of part of Rudder | no simple workaround
UX impact:
User visibility:
Effort required:
Priority:
0
Name check:
To do
Fix check:
To do
Regression:
No

Description

1. create criteria, search, save
2. create second criteria, but leave it empty, search save -> error
3. Refresh the page, all criteria are gone

Only happens in 8.2.
In 8.1 we cannot save empty group criteria


Files

clipboard-202412191433-eqnev.png (46.3 KB) clipboard-202412191433-eqnev.png Clark ANDRIANASOLO, 2024-12-19 14:33
clipboard-202412191435-essky.png (104 KB) clipboard-202412191435-essky.png Clark ANDRIANASOLO, 2024-12-19 14:35
clipboard-202412191439-hwuxg.png (92.6 KB) clipboard-202412191439-hwuxg.png Clark ANDRIANASOLO, 2024-12-19 14:39
Actions #1

Updated by François ARMAND 3 days ago

  • Assignee set to Clark ANDRIANASOLO
  • Priority changed from To review to 1 (highest)
  • Severity changed from Minor - inconvenience | misleading | easy workaround to Major - prevents use of part of Rudder | no simple workaround
Actions #2

Updated by Clark ANDRIANASOLO 3 days ago

  • Status changed from New to In progress

Updated by Clark ANDRIANASOLO 3 days ago · Edited

Also happens in 8.1, on criteria that needs to be filled with user-defined input and non-binary comparator e.g. Hostname = :

From here the user is supposed to be clicking on the search button before saving, to search for the nodes, which will output an error Inconsistency: Empty string not allowed and also disabled.
But the save button is not disabled, and after clicking on it, the error when saving redirects to the first tab Parameters with a huge error :

Then, reloading the page makes the error disappear because the form state is cleaned, and the criteria ends up being empty, even if in the LDAP the query is still there :

So, it seems to be a parsing problem, the Group mapping from LDAP fails to be parsed when such criterion has an empty value, and refuses to display all the criteria of the group then.
Since the criteria does not match anything, the resulting group does not query any node

Actions #4

Updated by Clark ANDRIANASOLO 3 days ago

Also, the inconsistent state is only kept when adding exactly the same criteria, e.g. Hostname =, then clicking on + adding a Hostname = again.
When changing = to , or Hostname to something else, the button is grayed out so this error cannot be obtained.

So, the actual use case where the error is likely to happen is when having a OR operand, in which case different @Hostname =" make sense (but an empty one still does not)

Actions #5

Updated by Clark ANDRIANASOLO 3 days ago

  • Status changed from In progress to Pending technical review
  • Assignee changed from Clark ANDRIANASOLO to François ARMAND
  • Pull Request set to https://github.com/Normation/rudder/pull/6097
Actions #6

Updated by Clark ANDRIANASOLO 2 days ago

the same update error also happens when the updating the group via API : when updating with a payload

{
  "query": {
    "select": "nodeAndPolicyServer",
    "composition": "And",
    "where": [
      {
        "objectType": "node",
        "attribute": "nodeHostname",
        "comparator": "eq",
        "value": "" 
      }
    ]
  }
}

the API returns the same error as above, but at the same time the group is still updated with the new invalid query, which is very surprising !

When updating again the group with the same payload, the response is idempotent : it's the group with the updated query. But then when getting the group with the GET endpoint, the query is simply empty (it is analogous to the empty list of criteria in the UI).
So there are several problem :
  • the group is still updated despite the response of the API being an error : the validation is not strict when writing
  • reading back the group from LDAP does additional on the value, depending on the comparator, but we don't need this validation when reading
Actions

Also available in: Atom PDF