Bug #26075
openTrying to save a group with empty criteria removes all entries
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
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
Updated by Clark ANDRIANASOLO 3 days ago · Edited
- File clipboard-202412191433-eqnev.png clipboard-202412191433-eqnev.png added
- File clipboard-202412191435-essky.png clipboard-202412191435-essky.png added
- File clipboard-202412191439-hwuxg.png clipboard-202412191439-hwuxg.png added
- Target version changed from 8.2.4 to 8.1.11
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
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)
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
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