Cerebrate v1.39 released with multiple bugs fixed

Fixed

  • Individual edits silently did nothing since v1.37. An undefined variable zeroed the entity’s primary key, so the UPDATE matched no row while save() still reported success. CRUDComponent::edit() now also refuses a primary key that changes between load and save, so this class of bug fails loudly.
  • Deleting a tag orphaned every application of it. The orphaned rows were invisible to counts and to the tag counter, but still occupied the unique index — 27% of the taggings table on one production instance. Tag deletion now cascades, and a migration prunes pre-existing orphans and rebuilds tag counters.
  • Tag names were never widened to 255 characters. The v1.35 migration targeted a tags table that does not exist, creating an empty one as a side effect. Now applied to tags_tags, preserving the unique index that the original would have silently dropped.
  • The importer never validated meta-field values. Regexes, value lists and type handlers were all bypassed, so an import could store values the same template rejects everywhere else — and those values could not afterwards be migrated to a newer template version. –skip-validation downgrades failures to warnings.
  • boolean and date meta-field types had no validation handler, so any text was accepted — including the five CSIRT network permission flags. Both handlers added, deliberately permissive about representation.
  • Meta-templates holding no meta-fields could not be deleted when the stored version matched the one on disk — the ordinary state of an unmodified template.
  • Meta-template updates that change a field’s type now detect conflicting stored values instead of updating silently.
  • Keycloak: a failed user edit showed the wrong flash message.

Meta-templates

All three need updating from the meta-templates page:

  • ENISA CSIRT Network v4 — ISO 3166-1 Code now accepts uppercase, the form the standard actually specifies.
  • FIRST Directory v2 — phone and phone-emergency rejected every value; the stored patterns included PCRE delimiters, which the validator wraps again.
  • IT infrastructure and services v3 — the five IP fields retyped from text to ipv4, so lookups match by CIDR containment rather than string equality.

Upgrading

  • Run both migration sets: bin/cake migrations migrate and bin/cake migrations migrate -p tags.
  • The IT infrastructure template will refuse to update automatically on instances holding non-IPv4 values (hostnames, IPv6) in those fields. Resolve the reported conflicts first.
  • Imports that previously succeeded while writing invalid values will now fail. Pass –skip-validation to keep the old behaviour.

Contributors

  • fix: enisa-csirt-inventory meta_template uppercase country codes by @DocArmoryTech in https://github.com/cerebrate-project/cerebrate/pull/229
  • fix: [meta-fields] add missing boolean and date type handlers by @DocArmoryTech in https://github.com/cerebrate-project/cerebrate/pull/237
  • fix: [meta-templates] empty template can’t be deleted at equal ver by @DocArmoryTech in https://github.com/cerebrate-project/cerebrate/pull/238
  • Fix/first directory phone regex by @DocArmoryTech in https://github.com/cerebrate-project/cerebrate/pull/230
  • Fix: importer validates meta fields by @DocArmoryTech in https://github.com/cerebrate-project/cerebrate/pull/232
  • chg: type it_infra_and_services meta_template IP as ipv4 by @DocArmoryTech in https://github.com/cerebrate-project/cerebrate/pull/234
  • fix(tags): deleting a tag orphans every use/application of it by @DocArmoryTech in https://github.com/cerebrate-project/cerebrate/pull/235
  • fix(migration): tags name widening was on wrong table by @DocArmoryTech in https://github.com/cerebrate-project/cerebrate/pull/236

Full Changelog: https://github.com/cerebrate-project/cerebrate/compare/v1.38…v1.39