Browse docs
Docs / CLI Reference / swarmfile-verify-history
View as Markdown

swarmfile-verify-history

On this page

swarmfile-verify-history is a standalone verifier for a repository's signed commit history. It walks the commit DAG from a branch's current HEAD back toward genesis, refetching each commit object from the hub, and recomputes every hash from the commit's own facts to prove the chain hasn't been tampered with: each parent link resolves and each stored hash matches what its facts actually hash to.

Every desktop installer carries it, and the Linux .deb, macOS .pkg and Windows installers put it on PATH (/usr/bin on Linux, /usr/local/bin on macOS, or the Windows install folder); a macOS .dmg-only install needs one .pkg (or Diagnostics → Reinstall) run for that entry.

The verifier is open source (dual MIT/Apache-2.0): source, releases and its test vectors are at swarmfile-verify-history, so checking the history doesn't require trusting our binary.

It also verifies the hub's checkpoint signatures. Every checkpoint the hub has published for the branch is fetched and its signature checked against a public-key ring - see the trust caveat below.

It does its own minimal HTTP GETs, with no dependency on a running engine or mount, so it can run on a CI box or an audit host.

Usage#

swarmfile-verify-history \
  --hub-url https://hub.swarmfile.com/orgs/org_.../repositories/proj_... \
  --org-id org_... \
  --repository-id proj_... \
  --branch main \
  --header 'Authorization: Bearer <token>'

--hub-url is the repository-scoped base: the verifier appends /history/… and /metadata/… paths to it, while --org-id/--repository-id identify the org and repository to verify. When the URL is in the /orgs/<org>/repositories/<repository> form, its two segments must be the same ids (the verifier validates them; use ids, not slugs, in the URL).

Add --json for a machine-readable report.

Flags#

FlagDescription
--hub-url <URL>Repository-scoped hub base URL (required) - the repository this run verifies, e.g. https://hub.swarmfile.com/orgs/org_.../repositories/proj_....
--repository-id <ID>Repository to verify (required).
--org-id <ID>Org id (required).
--branch <NAME>Branch to verify. Default main.
--header "Key: Value"Extra raw header, repeatable - pass whatever auth header this deployment requires (for example, Authorization: Bearer …). No auth scheme is hardcoded.
--header-file <FILE>Read extra raw headers from a file, one Key: Value per line (repeatable). Prefer this over --header for tokens so secrets do not appear in the process list.
--checkpoint-hash <HASH>Stop walking when this commit is reached (inclusive), instead of continuing to genesis. Use when older history has been pruned server-side.
--pin-key <PUBKEY|FILE>Pin the hub's checkpoint-signing Ed25519 public key out-of-band (64 hex, base64, or a file path). Repeatable for key rotation.
--check-host-identityFetch and verify the hub's signed /.well-known/swarmfile.json (its wire shape and synthetic fixture ship with the verifier's public-repo template and publish with its next release): require its origin to equal the --hub-url origin, check the self-signature, and require its key to be the active checkpoint key (or one of your --pin-keys). HTTPS is required unless the hub is loopback; redirects are refused and the statement must be at most one hour old. A hub that does not serve the document fails this check. Self-hosted servers serve it (set SWARMFILE_SERVER_PUBLIC_URL); the hosted hub serves it at the hub origin (dispatch needs the same history-signing secret and HUB_PUBLIC_ORIGIN).
--write-provenance <FILE>After a fully successful origin verification, write a portable manifest: the canonical origin, the head's commit facts and tree CID, every signed checkpoint, the key ring, and the origin's signed /.well-known/swarmfile.json when it serves one. It refuses to write unless every checkpoint verifies, the confirmed head has one, and the head tree agrees with headTreeCid. --provenance consumes it.
--pin-manifest <BLAKE3>Pin the manifest FILE's BLAKE3, obtained out-of-band. --provenance refuses a different file, so every field-branch, ids, checkpoints, keys-is authenticated, not just the head the checkpoint signs.
--verify-blocks [N]Sample up to N files (default 3) from the mirror, fetch their manifest block and-for a plaintext manifest-one chunk block, and re-hash each against its content id. Requires a matching head commit in --mirror-*, or a matching commit/tree in --provenance; a sealed/unparseable managed manifest is reported as not content-verifiable (its leaf cid is the plaintext hash). This proves the sampled bytes are stored, not that every block is served; a sealed managed manifest gets its manifest block hashed but no chunk.
--origin <URL>With --provenance, bind the manifest's origin label to the host whose key you pinned (e.g. https://hub.example.com). The manifest's origin is not signed by itself; this makes a relabelled manifest fail.
--provenance <FILE>Verify the repository named by --hub-url as a mirror against a manifest, without contacting the origin. Requires at least one --pin-key: the manifest is a file, so its key ring is untrusted input and a pin is the only offline trust anchor. The head is re-hashed, its checkpoint and (when present) the host-identity statement are signature-checked against the pins, and the mirror passes on a matching confirmed head commit, or a matching head tree (a plaintext destination written by swarmfile-mirror in provenance mode preserves the source tree/lineage, so it matches; an ordinary plaintext copy has a different commit DAG but the same content tree; a managed/E2E mirror copy re-seals, so its tree differs (a same-server swarmfile-server admin copy-repository copies the key/data without re-sealing)). originAttested reports whether the origin statement was carried and verified. Cannot combine with --check-host-identity or --mirror-*.
--mirror-hub-url, --mirror-repository-id, --mirror-org-id, --mirror-branch, --mirror-headerCompare a mirror's confirmed head commit to the origin's verified head commit. mirrorHeadMatches is true only when the mirror's confirmed head commit equals the origin's verified head commit; a mismatch (or a mirror with no confirmed head) is a failure. The commit hash binds the tree CID, so a matching head cannot substitute a different tree. The mirror's own signatures/claims are not trusted, and the verifier does not fetch the mirror's tree objects or blocks - this is head-commit identity, not a byte-serving proof. Read it together with the checkpoint signature/pin result; the checker does not require the head itself to be checkpointed.
--jsonEmit JSON instead of the human-readable report.

What it proves - and what it doesn't#

  • Structural integrity is real: every hash recomputes and every parent link resolves across the commits the hub served. That shows the chain is internally consistent; independent assurance that the hub is attesting to the same chain it originally recorded comes from the signed checkpoints below.
  • Signatures without --pin-key are checked against the key ring fetched from the same hub being audited (trust-on-first-use). That proves the checkpoints were signed by whatever key that hub currently publishes - not that the key is the hub's real one. The report says so on every run.
  • With --pin-key signatures are verified only against keys you supply out-of-band; the run fails if none is in the hub's ring, and a checkpoint signed by any other key fails. This is the mode that gives independent assurance.
  • Where checkpoint signing isn't enabled, the key route answers 404: unpinned that reads as "verifiable history isn't enabled here" (informational, exit OK); with --pin-key it is a failure.
  • --mirror-* proves head-commit identity, not mirror trust or byte serving: the origin's commit chain/checkpoints are verified exactly as above, and the mirror contributes only its confirmed head commit. A match means the mirror's head is the same commit/tree as the origin's verified head; the verifier does not fetch the mirror's tree/blocks or require the head to be checkpointed. An ordinary swarmfile-mirror copy does not preserve the commit DAG - use a replica that does, or a plaintext provenance-mode mirror copy (which matches by commit or tree).
  • --provenance proves the manifest's head is signed by a pinned key and (when present) that the origin's identity statement is genuine and pinned; originAttested: false means the origin served no statement and the origin NAME is only a label. A tree/commit match still does not prove the mirror serves the tree object or any block - fetch a file to check bytes.
  • --check-host-identity adds a key↔origin binding: the statement's self-signature is checked over swarmfile-host-v2 (origin, key id and issue time), its origin must equal the --hub-url origin, and its key must be the ring's active key (or a pinned key). The statement is signed from the server's configured public origin, never the request Host, so a mirror cannot make the origin vouch for another hostname. TLS to that origin is the trust anchor; the flag fails closed on a server that does not serve the document, including a branch with no confirmed commits.

Exit code is non-zero on any verification failure, so it is safe to gate CI on.

Something wrong or missing? Report a docs issue.