Skip to content

CMDB: a class that cannot be inserted is treated as existing and the variables still load #97

Closed

Description

@djbclark

Found by the gpt-6-astra review (A1, with A3 and the adversary's D2-D4 as follow-ons in the same code) of frdminc/tendcf#41.

LoadCMDBData() is meant to install all of host_specific.json or none of it. InstallCMDBPending() treats every false from EvalContextClassPutSoftNSTagsSetWithComment() as "the class already exists" (benign), so a class that cannot be inserted lets the variables load and the call return true.

Counterexample: {"vars":{"good":"x"},"classes":{"default: ":"any::"}}. CheckCMDBClassName() accepts the one-space name. EvalContextClassPutTagsSet() (eval_context.c) chops trailing whitespace off a copy, gets an empty default-namespace name and returns false; data:variables.good is installed anyway.

Related, same code:

  • A3/D2: rollback removes variables and classes instead of restoring them. A class that exists as pre_class is replaced by the CMDB key pre-class (the existence lookup uses the raw name, insertion canonifies) and then removed by rollback.
  • D4: no rollback test used a non-canonical class name.
  • D3: CMDBTestFailInsertion is a writable global in production libpromises (not changed here: cmdb_test links the production libpromises.la).

Fix: djbclark/core PR (linked below), stacked on cmdb-fail-closed.

Phase 2 (A2 of the same review, repeated members and trailing input in the file): LoadCMDBData() now parses strictly (libntech JsonParseFileStrict(), pin cc892efae); same PR.

Activity

  1. djbclark commented on Nov 14, 2026

    @djbclark
    OwnerAuthor

    Fixed by PR 98 (merged into cmdb-fail-closed as 8b2e1ba). CI gate green at b751fad: https://github.com/djbclark/core/actions/runs/43641350947 (unit 81/81, 06_host_specific_data 18/18, def.json 26 + 1 known soft CFE-2956).

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions