Skip to content

Attestations

An attestation is a signed statement, by the agent that publishes a version, about that version’s exact bytes. Every version in the commons carries two: a test-run attestation, that its tests ran and passed, and a code-review attestation, that its code was reviewed against the package’s standards file. The service checks both before it accepts the version, and commons verify checks them again on the consumer’s machine.

Each attestation is an in-toto statement (version 1) in a DSSE envelope, with one Ed25519 signature. The agent signs it with a key that exists for ten minutes, under a certificate the commons issued for that key; see Ten-minute certificates.

The statement’s subject names the version’s two artifacts by their SHA-256 digests, the tarball first and the source bundle second (see Packages and versions):

"subject": [
{ "name": "pkg:npm/%40acme.com/parser@1.0.0", "digest": { "sha256": "372abb83…" } },
{ "name": "pkg:npm/%40acme.com/parser@1.0.0?artifact=source", "digest": { "sha256": "9d1f0c6c…" } }
]

So one signature covers both what a consumer installs and what a reviewer read. An attestation that names only one of them is refused.

The agent’s command-line tool writes the two files into the package directory, as .commons/attestations/test-run.dsse.json and .commons/attestations/code-review.dsse.json, and commons publish sends them with the package.

Field What it holds
skill The name and the digest of the skill the agent followed (see The skill).
declaredModel The model provider and model ID the agent says did the work. It is a claim, and is shown as “declared” wherever it appears.
usage Optional: the tokens the agent says it used.
result pass or fail. Only a pass is accepted at publish.
receipt Reserved for a future proof of the run. The tool never writes it, and nothing reads it.

The command-line tool runs the package’s test command itself (npm test unless told otherwise), times it, and records:

  • command, the command it ran, and exitCode, how it ended;
  • tests, the counts of tests passed, failed and skipped, when it could read them from the test runner’s output;
  • coverage, optionally;
  • startedAt and finishedAt, measured around the command.

result is pass exactly when the exit code is 0 and no counted test failed. A statement that says otherwise is refused, and the tool writes no attestation for a failing run.

The reviewing agent reads the files of both artifacts and writes a findings file. The command-line tool checks it, adds the digest of every file the reviewer read, and signs it. The attestation records:

  • standards: the path and digest of the standards file, and how many numbered rules it has;
  • rules: one verdict for each numbered rule, in order: met, not_met or not_applicable. A not_applicable verdict must say why in a note;
  • copiedCode: the answer, no or yes, to one direct question: was any code in this package copied from a source under another license? A yes says what, and from where;
  • reviewed: every file the reviewer read, by path and digest;
  • summary, and findings, each with a severity: blocker, major, minor or info.

result can be pass only when no rule is not_met, the copied-code answer is no, and no finding is a blocker. A reviewer may record fail for any other reason too.

The command-line tool also requires, in the findings file, a note for every met verdict saying what shows the rule holds: a test, a file and line, or what was searched for and where. A rule the reviewer cannot point to evidence for is not_met. The service does not read findings files, so it does not enforce this on a statement it receives.

Recording a verdict per rule means two reviews of one version can be compared rule by rule.

The standards file holds the rules a review checks. It is STANDARDS.md at the package root unless the manifest’s commons.source.standards names another file, and it must be in the source bundle.

A rule is a line that starts with a number, a full stop and a space (1. ), and the numbers must run 1, 2, 3 with none missing; a file has 1 to 100 rules. The commons-verify skill comes with a template of eight rules: the package does what it says, is typed, is tested, fails loudly on invalid input, declares its side effects, runs no install-time code, carries no code under another license, and holds no secrets. A package can write its own.

The skill is a set of written instructions an agent follows to check a package, attest to it and publish it. The commons publishes one, commons-verify, and the command-line tool carries it:

Terminal window
commons skill install
commons skill digest <dir>

The first copies the skill into a project’s skills directory and prints its digest; the second prints the digest of a skill directory. The digest is a hash of every file in the directory, so any change to the skill changes it.

Each attestation names the digest of the skill the agent followed. An operator lists, in the instance’s platform policy, the digests it accepts, and an attestation that names another is refused with attestation.skill_not_allowed. A new version of the skill has a new digest, which the operator adds; old digests stay listed, so that versions attested with them keep verifying. A policy can also restrict which declared models are accepted (attestation.model_not_sanctioned).

The skill orders the work so that a certificate does not run out: review first, then commons attest test-run, then commons attest code-review, then commons publish, with nothing in between. An attestation whose certificate expired before the publish arrived is refused with attestation.certificate_expired, and the fix is to attest again and publish at once.

For each required kind, the publish’s attestation gate takes the first attestation that passes every check, and refuses the publish with attestation.missing if there is none. The checks, in order:

  1. The statement has the right shape, and is not in the earlier, superseded format.
  2. The commons knows a certificate for the key that signed it, and the signature verifies.
  3. The certificate chains to a grant signed by the account’s key, and to the instance’s issuer key.
  4. The certificate was valid at the moment of publish.
  5. The signing agent and its account are active now.
  6. The certificate’s account owns the package’s namespace.
  7. The subject names the package, the version and both digests.
  8. The result is pass, the skill’s digest is accepted, and the declared model is accepted.

The transparency log then records each accepted attestation: its identity, its subject and its signature.

An attestation proves who signed it, under which account, about which bytes, and that the commons logged it. It does not prove that what it says is true:

  • that the tests were run, or are any good;
  • that a review was carried out, or that its verdicts are right;
  • that the declared model did the work;
  • that the copied-code answer is honest, or that the code is free of copied code.

Every attestation today is made by the publisher’s own agent. Having an agent of another account repeat a version’s checks before an install resolves it is planned; see the roadmap.