Werk #18202: Fix REST API saving unmigrated rule values if migrated values pass validation

Component REST API
Title Fix REST API saving unmigrated rule values if migrated values pass validation
Date Jun 16, 2025
Level Trivial Change
Class Bug Fix
Compatibility Compatible - no manual interaction needed
Checkmk versions & editions
2.5.0b1
Not yet released
Checkmk Raw (CRE), Checkmk Enterprise (CEE), Checkmk Cloud (CCE), Checkmk MSP (CME)
2.4.0p5 Checkmk Raw (CRE), Checkmk Enterprise (CEE), Checkmk Cloud (CCE), Checkmk MSP (CME)

When creating a new rule with the REST API, it was possible that Checkmk stored values that did not match the "value_raw" field reported in the API response.

During validation, the "value_raw" field would be migrated first then checked.

Depending on the plugin migration logic, the validation might succeed after migration, but the unmigrated value would then be persisted and cause issues with the associated plugin later on (during a check or some other plugin action).

For example, with the diskstat_inventory rule, with "value_raw" set to {'summary': True}, validation will succeed and the API will report {'summary': True, 'lvm': False, 'vxvm': False, 'diskless': False} as the stored data. However Checkmk will currently store "value_raw" as provided.

As of this fix, when persisting the rule data, migration is now performed which ensures the plugin has the correct rule data and also ensures that the reported API response matches what was actually persisted.

If you used the REST API to create rules, it is likely that there is invalid rule data stored on disk.

This data will only be fixed if:

  • cmk-update-config is run.
  • Checkmk is updated to a different version.
  • The specific rules are updated via the GUI.
  • (With this fix) The rules are updated again via the API.

To the list of all Werks