Skip to content

CMDB loader ignores unknown keys inside class/variable metadata objects #68

Open

Description

@djbclark

What is wrong

The CMDB loader silently ignores unknown keys inside class and variable metadata objects. It refuses unknown top-level keys for exactly this reason, so this is inconsistent. The fork has identical code, so this is not an overlay divergence; fix it fork-first, then re-export the overlay patch.

Where

overlay/core/0002...patch:983 (applied cmdb.c:952-969) at 75db441:

if (JSON_NOT_NULL(class_exprs) &&

and the matching reg_exprs check. Keys other than class_expressions, regular_expressions, tags and comment are never looked at.

Scenario

"classes": {"maint": {"class_expression": ["!prod::"]}} (singular, misspelled) defines maint unconditionally, where a correctly spelled key with a non-any:: value would be refused. Same with "variables": {"x": {"value": 1, "tag": [...]}}. It conflicts with the comment at cmdb.c:1208-1211 ("a misspelled 'variables' would drop an interlock").

Suggested fix

Refuse unknown member names in class and variable metadata objects (fork first, then re-export as an overlay patch). Add cmdb_test cases for a misspelled class_expression and tag.

Found in review of #65 (head 75db441).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions