Skip to content

The transparency log

The commons keeps a public, append-only log. Every account record, namespace record, agent certificate, accepted attestation and change of status is an entry in it. Anyone can read the whole log and check that it only ever grows, and commons verify checks that everything a version relies on is in it. This is what lets a consumer check who published a version without taking the service’s word for it.

The log is one sequence of entries. An entry, once written, keeps its index for good. The log’s state at any size is one hash, the root of a Merkle tree over the entries, computed as RFC 6962 defines. Changing, removing or reordering any entry changes the root.

The log is in the C2SP tile-log format, the format of Sigstore’s Rekor v2, so tools written for that format can read and check it. Each instance runs its own log, named by its origin: the instance’s host followed by /-/commons/v1/log, such as commons.example/-/commons/v1/log.

Entry type Written when What it holds
account An account is created, or replaces its key The account record, whole: account name, key and sign-in provider
namespace A namespace is claimed The namespace record, whole: namespace, kind, owner and DNS proof
certificate A certificate is issued to an agent The certificate, whole: account, agent, grant, key and lifetime
attestation A version is published; one entry per attestation Package, version, attestation type, both digests, and the signature
status An account or agent is suspended, resumed or revoked Who, the new status, and whether the account or the operator did it

Each entry also carries the time it was written. An attestation entry’s time is the version’s publish time, so the publish time is committed in the log too.

Not logged: grants, which the first certificate issued under each names; the attestation envelopes themselves, which are served with the package; and anything about an account holder. No entry holds an email address or a provider’s identifier for a person.

Order is evidence. A namespace record is logged before any version is published under it, and an account record before any certificate issued under it, so their indexes are lower. commons verify checks that order.

The log’s signed state is a checkpoint: three lines (the origin, the number of entries, and the root hash) followed by a signature with the instance’s log key, an Ed25519 key. The service signs a new checkpoint each time it appends to the log.

commons.example/-/commons/v1/log
6
EodILAr930M1sXGCFQfpLm+Sz5+rE3b2btqZ1HnIcGU=
— commons.example/-/commons/v1/log GcUhBpFd1TlzE1bJxV4SZDv+KElykuJj/Phg2XsFf9LImRo+hW65UzwmniqRzRHEs0Vc/iOuBkNb4tck0pM9jIpxoAo=

An origin is never used for a different log: a consumer that has seen one log under a name treats a different log under the same name as a fork.

A checkpoint can also carry cosignatures from witnesses, parties that check each new checkpoint only adds to the one before and countersign it. The trust root lists the witnesses an instance sends its checkpoints to and how many must have cosigned (witnessThreshold). Today that number is 0: no cosignature is required, and commons verify reports a cosignature without depending on it. A witness independent of the operator is planned (see the roadmap).

The trust root is the one document a consumer holds for an instance. It lists the instance’s issuer keys, which sign account records, namespace records and certificates; the log’s key; and the witnesses. Everything else is checked against it. The service serves it at /-/commons/v1/trust-root; see Trust root and API description.

commons verify gets it in one of two ways:

  • From a file, named by --trust-root <file> or COMMONS_TRUST_ROOT, for an operator who hands it out some other way. Nothing is then fetched.
  • Otherwise from the service, over HTTPS (or from a loopback address), and only if the document names that service. The first copy is kept at <COMMONS_HOME>/instances/<host>/trust-root.json (COMMONS_HOME defaults to $XDG_CONFIG_HOME/commons, else ~/.config/commons; a port in the host is written after _, as localhost_8787), and every later run compares the served document with it.

If the served trust root ever differs from the kept copy, verification fails, saying the instance’s trust root has changed. The command never replaces the copy by itself, because a changed trust root is also what an attack looks like. Confirm the change by some other route first; then delete the directory <COMMONS_HOME>/instances/<host>/ and run the command again.

This is one fact per instance, not one decision per account: the consumer already chose which commons to install from, and the trust root is fetched from that same address. What it does mean is that a consumer trusts the commons it points at to say who its accounts are and who owns its namespaces.

Two kinds of proof follow from the tree, each a few hashes long:

  • An inclusion proof shows that a given entry is at a given index in the tree with a given root.
  • A consistency proof shows that the tree at a later size contains the tree at an earlier size unchanged: nothing was removed or rewritten in between.

Wherever the service returns something that is in the log, such as an account record, a namespace record or a certificate in a package’s record, it returns the entry with an inclusion proof and the checkpoint it leads to, in the C2SP tlog-proof format. A proof can be checked offline against the trust root.

The command-line tool keeps the last checkpoint it verified, at <COMMONS_HOME>/instances/<host>/checkpoint. Each time it fetches a newer one, it checks a consistency proof from the one it kept. A log that is smaller than before, or the same size with a different root, or a proof that does not hold, means the log has been forked or rolled back: commons verify and commons log checkpoint then exit with status 4.

The log is served without authentication under /-/commons/v1/log: /checkpoint, the tiles of the tree and the bundles of entries in the tile-log layout, and /entries/<index> for one entry with its proof. Any client of the tile-log format can read the whole log, recompute its root and compute any proof itself.

The command-line tool reads it too:

Terminal window
commons log checkpoint
commons log entry <index>
commons log watch --account <account>
commons log watch --namespace <namespace>

commons log watch reads the log from where its last run stopped and prints every entry that names the account (its records, certificates and status changes, and namespaces it owns or owned), or the namespace (its records, and attestations for packages under it). An account should watch its own name: inclusion shows that a key was logged, not that it is the account’s only one. If anyone bound a second key to the account, the entry would be in the log for the account to find.

commons verify <package> makes eleven checks, in order, and reports each:

# Check Passes when
1 installed The package is installed in the project, at the version asked for
2 record The commons has a record for that version
3 lockfile npm’s package-lock.json gives the integrity hash the record gives
4 tarball The tarball the commons serves hashes to the record’s digest
5 files The installed files are exactly the tarball’s files, byte for byte
6 log The trust root is available, the latest checkpoint verifies against it, and it extends the checkpoint seen last time
7 account Each signer’s account record is signed by the instance and is in the log
8 certificates Each signer’s certificate chains to its grant and account record, is in the log after the account record, and was valid at publish
9 namespace The namespace record is signed and in the log, was in force at publish, and names every signer’s account as owner
10 attestations Each attestation is in the log, after the namespace record and its certificate, names both digests, and meets the policy
11 tree Every other package installed in the project is the commons’s, with the same bytes

A check whose inputs did not pass is skipped. --package-only turns check 11 off, for a project that also installs packages from elsewhere. A pass prints one line, naming the namespace, its owner and how the owner signed in; --report prints the full report, and a failure always does.

So a pass tells a consumer:

  • the installed bytes are the bytes the commons published, and so is everything else installed;
  • the attestations were signed by an agent of the account that owned the package’s namespace when the version was published, under a certificate valid at that moment;
  • the account record, the namespace record, the certificates and the attestations are all in the log, in the right order, and the commons has shown this consumer the same log, only grown, as every time before.
  • That the attestations are true. See What an attestation does not prove.
  • Who the account holder is. An account record says how they signed in, not who they are; a domain namespace says someone could publish a DNS record under the domain.
  • That the account still behaves well. An account suspended after the publish does not fail verification: the version was signed while it was in good standing. The report shows the account’s current status, and whether it has replaced its key since.
  • Anything about the dependencies but their bytes. Check 11 compares every other installed package’s bytes with the commons; it does not check their signers or attestations.
  • That every consumer sees the same log. No party outside the commons countersigns the log yet. Two consumers shown two different logs would each find theirs consistent, and only comparing checkpoints would show the fork. The log makes a fork detectable, not impossible.

commons verify does not download the source bundle. It takes the bundle’s digest from the record and the log, so it confirms that the signers attested to a bundle with that digest, not that the bundle served is those bytes; whoever downloads the bundle checks that.

To run it, see Use a package, and verify it.