Registry operations

The privilege fix

The registry indexer used to require /var/run/docker.sock bind-mounted into its container. That socket is not a monitoring interface. It is the daemon control plane, and access to it is equivalent to root on the host: anything holding it can start, stop and delete containers, and can exec arbitrary commands inside them.

For a platform whose declared target is banks, government and defence, that is a finding an auditor raises on the first pass. It was recorded as such, and it is now fixed.

What replaced it

wasnowwhy it is narrower
docker ps over the raw socketdocker ps through a read-only socket proxythe proxy disables POST, so no create, start, stop, exec or delete is possible
docker exec headscale headscale nodes listHeadscale's HTTP API with a scoped keyno runtime exec; the key is scoped and expires
docker exec postgres psql ...PostgreSQL over TCP with bun's built-in clienta read-only SELECT, creds from an existing 600 file
docker exec litellm cat /app/config.yamlread the bind-mounted fileit was already a host file

The indexer now contains zero docker exec calls and no socket mount. Verified by grep, not by assertion.

The socket proxy listens on loopback only and permits containers, images, info and ping. POST=0 denies everything mutating, which is the property that matters: the proxy can read the estate and cannot alter it.

Bring-up

bringup.sh takes the graph from nothing to conformant in one command:

  1. generate the Neo4j password if absent
  2. start the read-only socket proxy
  3. start Neo4j
  4. wait for health
  5. apply the schema, then the generated registry graph
  6. refresh the host-derived registries with the bun indexer
  7. re-apply, then run the conformance checks

It is idempotent: every step tolerates already being done.

The conformance loop

doctor-loop.sh is the recursive loop closing. It regenerates the registries from the live host, reapplies them to the graph, runs every check, and records the outcome as an evidence artefact.

exit codemeaning
0conformant, every check returned zero findings
1findings present
2the loop could not run, the graph is unreachable

The distinction between 1 and 2 matters. A finding is a real result about the platform; a failure to run is a broken loop. Collapsing them into one non-zero code would hide the difference between the platform is non-conformant and we do not know.

Why a summary query

Twenty separate checks each returning an empty result set is awkward to alert on. doctor-summary.cypher returns one row per check with its finding count, which sums to a single number. That number is what the loop reports and what a scheduler can act on, while the detailed queries remain available for triage.

Schedule

Installed at /etc/cron.d/prodg-doctor, daily at 04:15 UTC, writing to /opt/prodg/data/registry-reports/. Every run leaves a timestamped report, so the evidence trail accumulates rather than being overwritten.

What a finding should trigger

A finding is not a crash and should not be handled as one. It is a fact about the platform that no playbook currently owns, which is the gap worth closing next: each check should map to a primitive, so that a service_without_loadout finding composes into a remediation rather than landing in a log.

What the loop found on its first real run

The conformance loop paid for itself immediately. Its first end-to-end run surfaced four defects in this platform's own work, three of them in code written the same day. That is the strongest possible argument for the loop existing.

defectwhat was wronghow it was found
Collector emitted no registry edgesemitEntry wrote MERGE (e:Entry:...) without a terminating semicolon, so the following MERGE (e)-[:IN_REGISTRY] ran as a separate statement with e unbound, creating orphan nodes instead of edges88 entries reported as unregistered
Full-pattern MERGE violated a constraintMERGE (e)-[:IN_REGISTRY]->(:Registry {key: ...}) attempts to create a new Registry node because an anonymous node in a MERGE pattern is created rather than matched, which then hit the uniqueness constraintthe apply failed with Node(12) already exists with label Registry
Check counted the meta-registry as unprovenancedmissing_provenance did not exclude the registry-of-registries, so 18 legitimate registry nodes were reported18 phantom findings
A playbook had no evidence stepsupply-chain-compromise had no verify or record step, so it could not be shown to have workedplaybook_without_evidence, correctly

The first two are the same class of mistake: a Cypher MERGE behaving differently from how it reads. Both are now fixed, and both carry a comment explaining why, so the next person does not reintroduce them.

Live state

The graph is up and queryable.

measurevalue
registries18
entries112
relationships223
primitives38
playbooks10
playbook steps100

The socket proxy is verified doing its job: GET /_ping returns 200 and POST /containers/create returns 403. The indexer reads 37 containers through it without ever touching the raw socket.

Legitimate findings that remain

Two checks return non-zero and both are correct, not defects. They are the loop working as intended.

  1. Three agents have no declared interface - the Hermes runtime profiles cypher, nexus and investigator act on the platform but their interface surfaces are not declared anywhere. An agent nothing can reach cannot be alerted on or held to account.
  2. Five primitives are declared but unused - assign-role, start-service, page-oncall, update-status and rollback-schema. The first four are the vocabulary running ahead of the scenarios. rollback-schema is the one that matters: it is defined, it is dangerous, and no playbook uses it, so schema rollback has no procedure.

They are not crashes

A finding is a fact about the platform, not a failure of the loop. The loop exits 1 and writes a report; it does not stop the platform and it does not pretend the finding is not there. Exit 2 is reserved for the loop itself being unable to run.

The gap worth closing next is that a finding has no owner. Each check should map to a primitive, so a service_without_loadout finding composes into a remediation rather than landing in a log.