Reference#

Reference · Operators

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_mv

materialized view, on insert.

checked → nodes for accepted rows, grouped by ak_name.

jobs/tree-ingest

external 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-put

external 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-put

external 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#

Reference data

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_mv on insert into checked; 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

ak_name

String

Node identity.

ak_public

SimpleAggregateFunction(max, String)

Public area of the key.

node_id

AggregateFunction(argMin, String, DateTime64(3))

Label: the host name the key claimed first, unless relabeled.

first_seen

SimpleAggregateFunction(min, Nullable(DateTime64(3)))

First accepted record.

trust

SimpleAggregateFunction(max, Enum8('untrusted' = 0, 'enrolled' = 1))

untrusted by default, enrolled once the operator records the key.

DEFAULT 'untrusted'

shirudo.expected_builds#

Reference data

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_mv into node_status

Row size:

~100 B (estimate).

Scale:

Builds you allow.

Reference fleet:

tens of rows, negligible

Columns (3)

Column

Type

Meaning

version_id

String

Build identifier of the shirudo binary, as in the keepalive body.

note

String

Free text for the operator.

added

DateTime

Defaults to now().

DEFAULT now()

shirudo.tree_pubs#

Reference data

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 of shirudo 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_mv into node_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_id

String

Tree name.

generation

UInt64

Publication number within the tree.

manifest_digest

String

OCI manifest of this publication.

parent_manifest_digest

String

Previous publication’s manifest; empty for the first.

head_seq

UInt64

Seq of the last operation in this publication.

segment_base_seq

UInt64

The segment holds the operations after this seq. 0 for the first segment.

DEFAULT 0

segment_manifest_digest

String

The sealed segment before this one; empty for the first.

DEFAULT ''

history_root

String

The tree’s history root at segment_base_seq; 64 zeros for the first segment.

DEFAULT repeat('0', 64)

published_at

DateTime64(3)

Load time, default now64(3).

DEFAULT now64(3)

shirudo.tree_ops#

Reference data

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_mv into node_sets; history_conflicts (view); node_ops_mv into node_ops; node_status_mv into node_status; node_vulns_mv into node_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_id

String

Tree name.

seq

UInt64

Position in the tree, from 1.

op

Enum8('add' = 1, 'delete' = 2)

Load or remove a upatch.

id

String

Upatch id the operation acts on.

selector

String

Which nodes it targets, as JSON. Read with JSONExtract for display.

repository

String

OCI repository of the payload.

manifest_digest

String

Payload manifest.

layer_digest

String

Payload layer.

payload_sha256

String

Hash of the payload. Feeds the set hash in check 6.

operation_digest

String

Hash of the operation. Folded into the chain root in check 4.

shirudo.upatch_fixes#

Reference data

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 (source fixes, from the operation’s fixes key); the operator (source manual)

Fires on insert:

nothing

Queried by:

node_vulns_mv into node_vulns

Row size:

~60 B (estimate).

Scale:

Advisory links across all operations.

Reference fleet:

negligible

Columns (5)

Column

Type

Meaning

tree_id

String

Tree name.

seq

UInt64

The add operation that carries the shield.

id

String

Upatch id.

advisory

String

Vulnerability id, matching sbom_vulns / kernel_vulns vuln_id.

source

Enum8('fixes' = 1, 'manual' = 2)

Where the link came from.

shirudo.settings#

Reference data

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.sql if empty

Fires on insert:

nothing

Queried by:

node_status_mv into node_status; node_vulns_mv into node_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

id

UInt8

Always 1.

DEFAULT 1

stale_seconds

UInt32

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.

stuck_seconds

UInt32

  1. How long a node may stay behind its tree’s head (check 5).

window

UInt32

  1. Operations a keepalive’s mask covers.

keepalive_retention_seconds

UInt32

  1. TTL of shirudo.keepalive.

DEFAULT 3600

boot_first_retention_seconds

UInt32

2592000 (30 days). TTL of shirudo.boot_first.

DEFAULT 2592000

sbom_stale_seconds

UInt32

172800 (2 days). Age after which a scan marks node_vulns rows sbom_stale.

DEFAULT 172800

updated

DateTime64(3)

Version column: the newest row wins.

DEFAULT now64(3)

shirudo.label_sets#

Reference data

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

by

Enum8('node_id' = 1, 'ak_name' = 2, 'config_root' = 3)

Whether node names a node_id, an ak_name, or the config_root of the nodes that booted that config image.

node

String

The node_id, ak_name or config_root.

labels

Map(String, String)

The whole set, key to value.

put_at

DateTime64(3)

When labels-put loaded it; the version ReplacingMergeTree keeps the newest of.

DEFAULT now64(3)

shirudo.shield_catalog#

Reference data

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

reference

String

The package, oci://<registry>/<repository>:<version>.

id

String

The upatch, the id of its tree entry.

package

String

Package name.

version

String

Package version.

manifest_digest

String

The package’s manifest, 64 lowercase hex digits without sha256:; bpm tree append takes the package by the reference and this digest.

fixes

Array(String)

The advisories of the entry’s fixes, in byte order.

selector

String

The entry’s selector as compact JSON.

description

String

The package’s description.

put_at

DateTime64(3)

When shields-put loaded it; the version ReplacingMergeTree keeps the newest of.

DEFAULT now64(3)

shirudo.enrollments#

Reference data

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

ak_name

String

The attestation key’s name.

ek_name

String

The endorsement key’s name the builder saw beside it, empty when it gave none. Nothing checks against it; attest verify –ek-name does.

node_id

String

The name the builder gave the node, empty when it gave none.

source

String

The builder, as the file named it.

put_at

DateTime64(3)

When enroll-put loaded it.

DEFAULT now64(3)