Skip to content

policy: cross-check the loaded CMDB against host_specific.json; refuse to actuate on any difference (Q10) - #42

Merged
djbclark merged 13 commits into
masterfrom
policy-cmdb-crosscheck
Nov 14, 2026
Merged

djbclark merged 13 commits into
masterfrom
policy-cmdb-crosscheck

Conversation

@djbclark

@djbclark djbclark commented Nov 6, 2026 •

Copy link
Copy Markdown
Collaborator

Policy-side half of the interlock fail-open fix (djbclark's ruling Q10, 2026-11-02, option 3 of docs/architecture/tendcf-validate-proposal-2026-11-03.md §13). The fork-side half (all-or-nothing loader) is #41; this works with or without it.

Bug. interlock_blocked_<bundle> exists only for an interlock entry that loaded, and services are gated on !interlock_blocked_*. When the loader skips tendcf_interlock and installs tendcf_service, every service runs ungated.

Design (policy/tendcf_services.cf, bundle common tendcf_cmdb).

  1. It reads $(sys.workdir)/data/host_specific.json once (readjson, 5 MiB cap, guarded by not(isvariable("doc"))). Per vars key, it compares the file with what the loader installed: the key identifiers, the entry ids, and the whole container's storejson() text.

  2. Every problem is a positive class, defined from the current comparison, before tendcf_cmdb_refused:

    1. missing, unlisted, sections (any top-level key but vars) and badkey (a non-identifier key);
    2. foreign_var / foreign_class: any source=cmdb or source=augments_file variable outside data:variables.<identifier>, and any such class. These are read from the loaded state with inline variablesmatching()/classmatch(), so there is no variable a CMDB author can preset;
    3. partial_<key> (different ids) and differs_<key> (different content);
    4. uncomparable_<key> (a side that cannot be serialised) and noverdict_<key> (both texts exist, but the comparison gave neither "equal" nor "differs", e.g. text holding $().

    tendcf_cmdb_json_same_<key> is the only success class, and only noverdict reads it.

  3. Under refusal, both bundles' id lists are literal empty lists, so no pre_action, service, tombstone or daemon-reload is actuated. tendcf_interlocks reports once what differs. File-derived text is printed sanitised (characters outside [A-Za-z0-9._:@/-] become ?) and capped at 64 characters per name.

  4. It is a consistency check on one snapshot, not a sandbox. A file replaced before the read is compared and refused if it differs. A file replaced after the read is intentionally unseen, because what actuates is exactly the data that was checked.

  5. Evaluation, measured on the pinned fork (check 11, debug run): tendcf_cmdb was resolved 2 times, doc 1 time, file_json 10 times, tendcf_cmdb_refused 2 times, and the mutation ran 1 time. A class is set once and never cleared. A still-unset class is evaluated again on the second resolution, from the same snapshot. tendcf_cmdb shares one file with the gated bundles because of per-file resolution, and a split would still fail closed.

Installer (deploy/linux/tendcf-install.sh). put_data writes a root-owned 0600 sibling and renames it into place, keeping the backup.

Tests (tests/policy/run.sh).

  1. Check 9, real loader: refusal on presets of the checker's and the gates' variables, a hidden classes section, augments, and scalar/numeric-list values. Controls: a list of strings is accepted and actuates; the normal empty cases are quiet. A 70-character key is refused, and its report shows at most 64 characters.
  2. Check 10, a stand-in loader (tests/policy/sim-loader.cf): skips one container, a half-loaded container, an extra loaded variable, and data loaded with no file.
  3. Check 11 (tests/policy/probe-mutate.cf), a file replaced during the run:
    1. Replaced before the read: refused, the reason is "content differs", and nothing runs.
    2. Replaced after the read: not refused; the loaded pre_action runs and the replacement never does.
    3. Replaced before the read with a pre_action element holding $(: refused as "reached no verdict", and nothing runs.
    4. A debug run pins the evaluation counts above.
  4. Check 6b (Linux, real systemd): with the interlock container skipped, no unit is rendered and no systemctl runs.

Reviews. Each round's fixes were reproduced in CI before they landed.

  1. Round 1 (frontier gpt-6-astra A1/A2; adversary L1-L3): fixed in 506e2f6, d1b0c30 and 56cf91f.
  2. Round 2 (Astra VERDICT CHANGES; adversary BLOCK):
    1. Astra A1 (High), a sticky "equal" class masking a later mismatch: fixed with a single read and positive classes.
    2. Astra A2 / adversary L2, raw text in reports: fixed with sanitised reports.
    3. Astra B3: a list-of-strings control was added.
    4. Astra B6 / adversary L1: atomic put_data.
    5. Adversary M1 (Medium), CMDB presets of function-call variables: fixed with the loaded-state checks, reproduced first at 8ee5bba.
    6. Adversary I1: augments are refused (tag source=augments_file).
  3. Round 3 (both APPROVE at db1e73e), with three Low findings fixed here:
    1. Adversary L1, a comparison with no verdict was not refused. Reproduced at 1a8647f, where the loaded pre_action ran; fixed in 49681a7 (noverdict).
    2. Astra A2, safe keys bypassed the 64-character report cap. Reproduced; fixed with key_clean.
    3. Astra A1 / adversary I5, "decided once" overstated: replaced by the measured counts (5a2228d).
  4. Round 4, a confirm at 5a2228d. Astra: "VERDICT: APPROVE ... L1 resolved within the declared snapshot contract", with the caveat that the sticky json_same class is safe only because doc is read once and the loaded containers are stable. Adversary: see below.

CI.

  1. Reproductions (red as intended): https://github.com/frdminc/tendcf/actions/runs/43614879971 (8ee5bba, round 2) and https://github.com/frdminc/tendcf/actions/runs/43629843957 (1a8647f, round 3, exactly the 5 new assertions per leg).
  2. Final head 5a2228d: Check https://github.com/frdminc/tendcf/actions/runs/43630545580; Linux https://github.com/frdminc/tendcf/actions/runs/43630545727 passed all policy tests on 4 legs. Its ubuntu-24.04 s1_probe list-unit-files: rc=1 failure is the known flake CI: linux.yml S1 unit-classifier probe fails intermittently on ubuntu-24.04 (list-unit-files tendcf-s1-gen* rc=1) #51, and the job passed on attempt 3 (all 4 legs green, including the root-owned install steps).

Follow-ups filed: #57 (installer: validate before publish, roll back on a refusal), #58 (concurrent publishers), #59 (control-character report fixture; consider --no-augments), #60 (keys of ~996+ characters, match-scope keys, root-only channels).

Adversary verdict (round 4, head 5a2228d). "APPROVE, no Critical, High, Medium or Low findings. Round 3's L1 is closed: noverdict is a positive problem class with literal-argument guards, decided after the two classes it reads. json_same cannot hide a difference and cannot be preset through a channel the check accepts." Its four Info notes: I1 and I2 (class-name length thresholds, and -D tendcf_cmdb_json_same_<k> as one more root-only channel) are added to #60; I3 confirms key_clean; I4 says the one-file rationale is untested and should be re-tested before any split.

🤖 Generated with Claude Code


Note

High Risk
Changes core supervision gating: any CMDB/loader mismatch now blocks all interlocks, services, and tombstones on every agent run, with large new policy surface area and extensive behavioral tests.

Overview
Adds a fail-closed CMDB cross-check (proposal §13 option 3) so a partial or inconsistent host_specific.json load cannot leave services ungated when interlocks are skipped.

The new bundle common tendcf_cmdb in tendcf_services.cf reads host_specific.json once, compares every vars key to data:variables.* (keys, entry ids, and full storejson() content), and rejects extra sections, non-identifier keys, foreign CMDB/augments presets, and uncomparable or inconclusive comparisons. On any problem it sets tendcf_cmdb_refused, clears interlock_ids / service_ids, blocks systemctl daemon-reload, and tendcf_interlocks reports the mismatch once with no actuation.

put_data in tendcf-install.sh now installs CMDB data via write-then-rename so the agent never sees a half-written file. The architecture doc records the implementation; tests/policy/run.sh gains checks 9–11 (real loader, sim-loader.cf stand-in, and probe-mutate.cf for mid-run file replacement) plus JSON fixtures.

Reviewed by Cursor Bugbot for commit 5a2228d. Bugbot is set up for automated code reviews on this repo. Configure here.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-06T15:53:11.527220Z 06aeb4d PR opened
🔒 Security Review ✅ Completed 2026-11-06T15:55:08.665134Z 06aeb4d PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

…e to actuate on any difference (Q10, proposal 13 option 3)
@djbclark
djbclark force-pushed the policy-cmdb-crosscheck branch from 71245b8 to b0c48e7 Compare November 14, 2026 14:56
@cursor

cursor Bot commented Nov 14, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: 37d04ccc-ca9b-4596-8bfd-a7ec03d2f6e7)

…a sections and non-identifier keys, clear preset id lists on refusal (PR 42 review: Astra A1/A2, adversary L1-L3)

F1: tendcf_cmdb compares storejson() of each vars container with the loaded one; an uncomputable comparison is a difference.
F2: any top-level key other than vars is refused (the loader also applies variables and classes); the two daemon-reload commands carry !tendcf_cmdb_refused.
F3: a vars key that is not [A-Za-z0-9_]+ is refused; interlock_ids and service_ids are set to empty lists under the refusal.
F4: the common-bundle ordering wording now states the vars/classes pre-evaluation guarantee with the pinned source, and that this is not a sandbox.
Tests: run.sh checks 9-10 (variables collision, classes section, scoped preset, same-id changed value via the stand-in loader).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@cursor

cursor Bot commented Nov 14, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: 8b922561-c95c-47f4-a1e7-3a5f690c5b5a)

…an uncomparable vars value is refused

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@cursor

cursor Bot commented Nov 14, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: 84fbaa31-84ae-4a16-8add-453f02a7c86e)

…ings round-trips equal); fix the wording

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@cursor

cursor Bot commented Nov 14, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: b8b8ab5b-9e8e-48ba-b847-91eae9fc1991)

…presets, hidden classes section, augments) and count tendcf_cmdb evaluations

Deliberately red against 56cf91f's policy: the new checks 9 cases expect a refusal the policy cannot give yet. Check 11 only observes how often the engine evaluates tendcf_cmdb.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@cursor

cursor Bot commented Nov 14, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: b85d2d93-0380-46bb-ba5f-45aa3014dc57)

…ide data:variables.<identifier>, define problem classes positively from the current comparison, sanitise reported text; installer writes data by atomic rename

PR 42 round 2 (Astra A1/A2, adversary M1/L1/L2/I1). Closes the preset of the checker's own variables and of the gates' id lists (a vars promise with a function-call rvalue is skipped when the variable exists), replaces the sticky tendcf_cmdb_json_equal_* negation with a differs class and an uncomparable class, and prints file-derived text only in a sanitised, capped form. Docs and header corrected to what the source supports.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@cursor

cursor Bot commented Nov 14, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: 65423997-1062-4f51-a642-f646ddebaae3)

…r acts on a replaced file; qualify the preset and evaluation docs to what CI measured; classes-hidden asserts the class and section

Check 11 on d288c81 showed tendcf_cmdb's vars, readjson of doc included, are visited on every pass while its classes are decided once, so a later pass read a replaced file the decision never saw. doc is now skipped once it exists.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@cursor

cursor Bot commented Nov 14, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: ba2adda0-1ac4-449b-b65a-1bf2a7ca706e)

…ints the policy's own report text, which the refusal grep matched), pins the single expected outcome and the one read of the file

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@cursor

cursor Bot commented Nov 14, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: abfea8bd-44cc-40d3-a95d-a0456d25a234)

… read (refused, content differs) and after it (not refused, loaded pre_action runs), each with one outcome

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@cursor

cursor Bot commented Nov 14, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: 14375043-4db7-42ae-b6d9-a7dd1446f7dc)

…evaluation counts and the two probe timings; presets may survive or be replaced

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@cursor

cursor Bot commented Nov 14, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: 15ca612f-4e2e-458d-aed0-6964e0d7b759)

…t) and a 70-character key report case; both must fail on db1e73e's policy

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@cursor

cursor Bot commented Nov 14, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: 0e93cbe9-2189-451d-ba89-6a3b16103272)

djbclark and others added 2 commits November 14, 2026 14:09
…problem_noverdict classes, before tendcf_cmdb_refused); reports cap the key at 64 characters

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… (classes set once and never cleared, an unset class re-evaluated on the second resolution), why the bundles share one file, the no-verdict class; check-list header

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@cursor

cursor Bot commented Nov 14, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: da6e1553-2239-4acb-a26c-c11266553c37)

@djbclark
djbclark merged commit acec5b5 into master Nov 14, 2026
14 of 16 checks passed
djbclark added a commit that referenced this pull request Nov 14, 2026
Corrects the rulings record against the three reviews of PR 62:
schema facts (v6 and contract_version const 2 are implemented by PR 52;
later changes take the next unused version, grouping not ruled), stale
merge/pending statuses (PR 52, #42, #41 merged; WarpBuild run
succeeded), the spike lane's rails restored word for word with the
workflow-permission hardening marked as hardening, the light review tier
read conservatively (no waiver of routing or admission rules), the Linux
design-work freeze removed (later in the order, not paused), option-number
notes, and open items marked 'open: awaiting operator ruling' (Android
log/index ownership, root enforcement timing, reviewer eligibility,
schema grouping) with a new open-items list in 14. The rulings file is
now committed beside 14 as rulings-record-2026-11-14.md and local paths
are stripped from public docs. No new decisions.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
djbclark added a commit that referenced this pull request Nov 15, 2026
Corrects the rulings record against the three reviews of PR 62:
schema facts (v6 and contract_version const 2 are implemented by PR 52;
later changes take the next unused version, grouping not ruled), stale
merge/pending statuses (PR 52, #42, #41 merged; WarpBuild run
succeeded), the spike lane's rails restored word for word with the
workflow-permission hardening marked as hardening, the light review tier
read conservatively (no waiver of routing or admission rules), the Linux
design-work freeze removed (later in the order, not paused), option-number
notes, and open items marked 'open: awaiting operator ruling' (Android
log/index ownership, root enforcement timing, reviewer eligibility,
schema grouping) with a new open-items list in 14. The rulings file is
now committed beside 14 as rulings-record-2026-11-14.md and local paths
are stripped from public docs. No new decisions.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant