Reference#
What the checks compare a record against, and what the operator says of a node. nodes fills itself from accepted records; tree-ingest loads the tree tables; labels-put loads label_sets; enroll-put loads enrollments and raises trust in nodes; the operator writes builds, manual fixes and settings.
Schema: tools/backend/sql/20-reference.sql
Views, functions and jobs#
shirudo.nodes_mvmaterialized view, on insert.
checked → nodes for accepted rows, grouped by ak_name.
jobs/tree-ingestexternal job.
Runs shirudo bpm tree show –walk and loads every verified segment not yet loaded into tree_pubs, tree_ops and upatch_fixes (source fixes). All or nothing on a conflict.
jobs/labels-putexternal job.
Checks a file of label sets and loads it into label_sets in one insert, all or nothing, each row with one put_at later than any before.
jobs/enroll-putexternal job.
Checks a builder’s file of key bindings against enrollments, raises each key’s trust in nodes to enrolled and names its node there, then records the new bindings in enrollments. A key is bound once.
shirudo.nodes#
One row per attestation key: its public area, a human label, when it was first seen and its trust level.
Read through aggregates: argMinMerge(node_id), max(ak_public), min(first_seen), max(trust), GROUP BY ak_name.
To relabel, insert argMinState(‘<name>’, toDateTime64(0, 3)) for the ak_name. Epoch 0 wins argMin. Leave ak_public and first_seen out so they don’t change.
trust only ever rises. The operator inserts (ak_name, ‘enrolled’) once credential activation or a builder’s records show the key is a TPM’s, before or after the node’s first record; jobs/enroll-put does it from a builder’s records, with the node_id it gave at toDateTime64(0.001, 3), which a rename at epoch 0 still beats. It is shown but never part of status.
- Engine:
AggregatingMergeTree- Order by:
ak_name- Defined in:
tools/backend/sql/20-reference.sql- Written by:
nodes_mvon insert intochecked; the operator, to relabel a node- Fires on insert:
nothing
- Queried by:
latest(view);node_label_items(view);node_labels(view)- Row size:
~0.5 KB (estimate: ak_public dominates).
- Scale:
Every key ever seen. No TTL: a reprovisioned TPM adds a row and the old one stays.
- Reference fleet:
10,000 rows ≈ 5 MB
Columns (5)
Column |
Type |
Meaning |
|---|---|---|
|
|
Node identity. |
|
|
Public area of the key. |
|
|
Label: the host name the key claimed first, unless relabeled. |
|
|
First accepted record. |
|
|
untrusted by default, enrolled once the operator records the key.
|
shirudo.expected_builds#
The builds a node is allowed to run, by version_id. A node whose version_id is missing fails check 3 with (not expected).
- Engine:
ReplacingMergeTree- Order by:
version_id- Defined in:
tools/backend/sql/20-reference.sql- Written by:
the operator, or tools/put-shirudo-build
- Fires on insert:
nothing
- Queried by:
node_status_mvintonode_status- Row size:
~100 B (estimate).
- Scale:
Builds you allow.
- Reference fleet:
tens of rows, negligible
Columns (3)
Column |
Type |
Meaning |
|---|---|---|
|
|
Build identifier of the shirudo binary, as in the keepalive body. |
|
|
Free text for the operator. |
|
|
Defaults to now().
|
shirudo.tree_pubs#
One row per publication of a upatch tree. A publication is a segment of the tree holding the operations past segment_base_seq. Gives each tree’s head for check 5 and the time a node’s stuck clock starts.
published_at is when ingest loaded the row, not when the operator published. Ingest lag delays the stuck clock by the same amount.
Digests are 64 lowercase hex digits without a sha256: prefix.
The job holds every segment against what is loaded before inserting anything. One generation already loaded under a different manifest digest refuses the whole run, and nothing loads.
- Engine:
ReplacingMergeTree- Order by:
(tree_id, generation)- Defined in:
tools/backend/sql/20-reference.sql- Written by:
tools/backend/jobs/tree-ingest, from the verified output ofshirudo bpm tree show --walk: the newest publication and every sealed segment before it, back to seq 0- Fires on insert:
nothing
- Queried by:
node_status_mvintonode_status- Row size:
~450 B (estimate: six 64-hex digests and roots).
- Scale:
Publications (segments) per tree. Not per node.
- Reference fleet:
hundreds of rows, negligible
Columns (9)
Column |
Type |
Meaning |
|---|---|---|
|
|
Tree name. |
|
|
Publication number within the tree. |
|
|
OCI manifest of this publication. |
|
|
Previous publication’s manifest; empty for the first. |
|
|
Seq of the last operation in this publication. |
|
|
The segment holds the operations after this seq. 0 for the first segment.
|
|
|
The sealed segment before this one; empty for the first.
|
|
|
The tree’s history root at segment_base_seq; 64 zeros for the first segment.
|
|
|
Load time, default now64(3).
|
shirudo.tree_ops#
One row per operation of a tree. Operations never change once published, so reloading a publication replaces rows with identical ones.
selector is stored as JSON text and never evaluated. Whether it matched is read from the node’s mask, where code 2 means it did not.
- Engine:
ReplacingMergeTree- Order by:
(tree_id, seq)- Defined in:
tools/backend/sql/20-reference.sql- Written by:
tools/backend/jobs/tree-ingest, from every segment of the tree- Fires on insert:
nothing
- Queried by:
node_sets_mvintonode_sets;history_conflicts(view);node_ops_mvintonode_ops;node_status_mvintonode_status;node_vulns_mvintonode_vulns- Row size:
~350 B (estimate: four 64-hex digests, selector JSON).
- Scale:
Operations across all trees. Not per node.
- Reference fleet:
65,000 rows ≈ 23 MB
Columns (10)
Column |
Type |
Meaning |
|---|---|---|
|
|
Tree name. |
|
|
Position in the tree, from 1. |
|
|
Load or remove a upatch. |
|
|
Upatch id the operation acts on. |
|
|
Which nodes it targets, as JSON. Read with JSONExtract for display. |
|
|
OCI repository of the payload. |
|
|
Payload manifest. |
|
|
Payload layer. |
|
|
Hash of the payload. Feeds the set hash in check 6. |
|
|
Hash of the operation. Folded into the chain root in check 4. |
shirudo.upatch_fixes#
Which advisory an operation’s upatch shields against. This is what turns a vulnerability into shielded, pending or withdrawn in node_vulns.
When both exist for the same operation, fixes (signed in the publication) ranks above manual.
- Engine:
ReplacingMergeTree- Order by:
(tree_id, seq, advisory, source)- Defined in:
tools/backend/sql/20-reference.sql- Written by:
tools/backend/jobs/tree-ingest(sourcefixes, from the operation’s fixes key); the operator (sourcemanual)- Fires on insert:
nothing
- Queried by:
node_vulns_mvintonode_vulns- Row size:
~60 B (estimate).
- Scale:
Advisory links across all operations.
- Reference fleet:
negligible
Columns (5)
Column |
Type |
Meaning |
|---|---|---|
|
|
Tree name. |
|
|
The add operation that carries the shield. |
|
|
Upatch id. |
|
|
Vulnerability id, matching sbom_vulns / kernel_vulns vuln_id. |
|
|
Where the link came from. |
shirudo.settings#
Thresholds and retention, in exactly one row. Read with FINAL. To change a value, insert the whole row again with id 1.
Retention values take effect when apply-retention.sh runs (it ALTERs the TTL of keepalive and boot_first). The rest apply at the next refresh.
Keep sbom_stale_seconds below 7 days, the sbom_vulns TTL, so an image reads stale before its findings expire and it reads clean.
- Engine:
ReplacingMergeTree(updated)- Order by:
id- Defined in:
tools/backend/sql/20-reference.sql- Written by:
the operator; seeded once by
tools/backend/sql/20-reference.sqlif empty- Fires on insert:
nothing
- Queried by:
node_status_mvintonode_status;node_vulns_mvintonode_vulns;tools/backend/sql/apply-retention.sh- Row size:
~50 B.
- Scale:
Always one row (more until a merge).
- Reference fleet:
negligible
Columns (8)
Column |
Type |
Meaning |
|---|---|---|
|
|
Always 1.
|
|
|
600. A node with no record for this long is stale (check 2). Ten minutes because a tree sync holds the lock that keepalive needs. |
|
|
|
|
|
|
|
|
|
|
|
2592000 (30 days). TTL of shirudo.boot_first.
|
|
|
172800 (2 days). Age after which a scan marks node_vulns rows sbom_stale.
|
|
|
Version column: the newest row wins.
|
shirudo.label_sets#
The labels the operator gives a node out of band, one set per node_id, ak_name or config_root. Not what the node’s node.labels holds: tree sync matches selectors against that file, and nothing here reaches the node; a set by config_root is the one place they can agree.
Read with FINAL, or through node_labels: the newest put of a name replaces the set.
An empty map clears the set. A node’s labels are the union of its sets in node_labels; label_conflicts lists the keys they disagree on.
- Engine:
ReplacingMergeTree(put_at)- Order by:
(by, node)- Defined in:
tools/backend/sql/20-reference.sql- Written by:
jobs/labels-put
- Fires on insert:
nothing
- Queried by:
node_label_items(view)- Row size:
~200 B (estimate: a few short labels).
- Scale:
Every node and key ever labeled, each put once more until a merge.
- Reference fleet:
10,000 rows ≈ 2 MB
Columns (4)
Column |
Type |
Meaning |
|---|---|---|
|
|
Whether node names a node_id, an ak_name, or the config_root of the nodes that booted that config image. |
|
|
The node_id, ak_name or config_root. |
|
|
The whole set, key to value. |
|
|
When labels-put loaded it; the version ReplacingMergeTree keeps the newest of.
|
shirudo.shield_catalog#
The shields published to a registry, available to append to a tree: one row per [upatches.tree] entry of a pushed package. xtop’s shields view lists the newest of each id as available.
Read with FINAL: a put of the same reference and id replaces the row.
selector is copied as JSON text and never evaluated, as in tree_ops.
- Engine:
ReplacingMergeTree(put_at)- Order by:
(reference, id)- Defined in:
tools/backend/sql/20-reference.sql- Written by:
jobs/shields-put, from what tools/put-shields –catalog wrote
- Fires on insert:
nothing
- Queried by:
nothing in the schema
- Row size:
~500 B (estimate: a reference, a 64-hex digest, selector JSON).
- Scale:
Every version of every shield pushed. Not per node.
- Reference fleet:
thousands of rows, negligible
Columns (9)
Column |
Type |
Meaning |
|---|---|---|
|
|
The package, oci://<registry>/<repository>:<version>. |
|
|
The upatch, the id of its tree entry. |
|
|
Package name. |
|
|
Package version. |
|
|
The package’s manifest, 64 lowercase hex digits without sha256:; bpm tree append takes the package by the reference and this digest. |
|
|
The advisories of the entry’s fixes, in byte order. |
|
|
The entry’s selector as compact JSON. |
|
|
The package’s description. |
|
|
When shields-put loaded it; the version ReplacingMergeTree keeps the newest of.
|
shirudo.enrollments#
The attestation keys a builder created in a TPM, as it recorded them: what enrolled each key, where nodes only keeps that it is.
Read with FINAL. A key’s binding is written once; enroll-put refuses another.
The row may come before the node’s first record.
- Engine:
ReplacingMergeTree(put_at)- Order by:
ak_name- Defined in:
tools/backend/sql/20-reference.sql- Written by:
jobs/enroll-put
- Fires on insert:
nothing
- Queried by:
nothing in the schema
- Row size:
~250 B (estimate: two TPM names, a node_id and a source).
- Scale:
Every key a builder enrolled. No TTL.
- Reference fleet:
10,000 rows ≈ 2.5 MB
Columns (5)
Column |
Type |
Meaning |
|---|---|---|
|
|
The attestation key’s name. |
|
|
The endorsement key’s name the builder saw beside it, empty when it gave none. Nothing checks against it; attest verify –ek-name does. |
|
|
The name the builder gave the node, empty when it gave none. |
|
|
The builder, as the file named it. |
|
|
When enroll-put loaded it.
|