Decision: image signatures made without a kept key (T-0463)
Status: accepted, 2026-11-16. Reviewed before any code (see "Review" at the end).
What is asked #
cosign sign IMAGE with no key, which is cosign's default, signs with a key it throws away. An authority (Fulcio) gives that key a certificate of ten minutes that names who asked for it: an issuer (the sign-in service, such as https://token.actions.githubusercontent.com) and a subject (an email address or a URI, such as a workflow's). A transparency log (Rekor) records the signature and promises, under its own key, the time it saw it. cosign 3 keeps all of this as one JSON file, a bundle (application/vnd.dev.sigstore.bundle.v0.3+json), among the image's referrers. Older cosigns, and cosign 3 with --new-bundle-format=false, keep it under the tag sha256-HEX.sig with the certificate and the log's promise in the layer's annotations.
kith today takes keys only, and reads only the tag (crates/kith-runtime/src/signed.rs).
The rule #
signedBy (a container's, and a Cluster's spec.images[].signedBy) holds keys as it does today, and now also identities:
signedBy:
- { issuer: https://token.actions.githubusercontent.com,
subject: https://github.com/acme/tool/.github/workflows/release.yml@refs/heads/main,
authority: [<PEM certificate>, ...], # the authority's root, and its intermediates
log: <PEM public key>, # the log's key
tsa: [<PEM certificate>, ...] } # optional: the timestamp authority's root(s), 1 to 4
issuerandsubjectare matched whole, byte for byte. There are no patterns, which are a common way to accept more than was meant.authoritylists the certificates a signer's certificate must lead to: 1 to 4 of them. Those that sign themselves are the roots a chain ends at. The rest are intermediates, each held to its own validity at the log's time as the leaf is, so an intermediate that has been retired no longer passes. A root's own dates are not read.logis an ECDSA P-256 key, the same as Rekor's.tsais optional (a rule stored without it reads as before, and is the same identity with the same id). It gives the root certificates, 1 to 4, of the RFC 3161 timestamp authority that timed the signature. Without it a bundle of Rekor v2 (a timestamp, no promise) is refused, namingtsa; a bundle with a log's promise is taken as it was. With it,keyless::verifyrunstimestampbeforecheck: every RFC 3161 timestamp in the bundle (at most 4) must verify against one of the roots, or the bundle is refused. A Rekor v2 bundle is then timed by the earliest of their genTimes. A v1 bundle needs its timestamp too (it must be there and be the authority's; the time the certificate is held to is still the log's promise). A signature kept under the tag has no timestamp, so under a rule withtsait is refused.- Nothing is built in and nothing is fetched (no TUF). A wrong root or key refuses every signature. It never widens what runs.
- A template's identities narrow a rule's in the same way its keys do. An identity is the same identity when all four of its fields are equal.
- An older kithd reads
signedByasVec<String>, so it refuses to apply a rule or template that holds an object. A rule written by a newer control node and read by an older worker (controller.rstakes the strings ofsignedBy) keeps only its keys. A rule of identities alone then has no key, and nothing it covers is run. Neither case runs an image unsigned.
Where signatures are looked for #
For each digest (the image's manifest, and the list it was picked from), the two places are searched in turn, and the first signature that passes wins:
- Referrers.
oci_client::Client::pull_referrers(digest, artifactType=bundle v0.3)is read. That client falls back to the tagsha256-HEXwhen the registry has no referrers API. At most 32 manifests are read. For each one:- its
subject.digestmust be the digest being checked; - its first layer must be the bundle type;
- that layer is read up to 64 KiB, with its digest checked as it comes.
- its
- The tag
sha256-HEX.sig, as today. A layer withdev.sigstore.cosign/certificateis checked as a keyless signature. A layer without it is checked against keys, as before.
Exactly what is checked #
These are the same for both places. The only difference is where the certificate, signature, payload and log entry are read from. Each refusal names its reason.
- The certificate.
- In the bundle, it is
verificationMaterial.certificate.rawBytes, DER in base64. In the tag, it isdev.sigstore.cosign/certificate, PEM. - Only one certificate is taken. A bundle's
x509CertificateChainis read only for its first certificate, and the chain annotation is ignored: only the rule'sauthoritycertificates are trusted.
- In the bundle, it is
- The log's promise (SET).
- The bundle's first
tlogEntries[0]is read. Its kind is read from the body the log signed, not fromkindVersion, and must bedsse 0.0.1orhashedrekord 0.0.1. ItslogId.keyIdmust equal SHA-256 of the DER of the rule'slogkey. - The tag has
dev.sigstore.cosign/bundle={SignedEntryTimestamp, Payload{body, integratedTime, logIndex, logID}}. - The bytes checked are the JCS form (keys sorted, no spaces) of
{"body":"<canonicalizedBody, base64>","integratedTime":N,"logID":"<keyId, hex>","logIndex":N}. The signature over them,signedEntryTimestamp(ASN.1 ECDSA, P-256, SHA-256), must verify with the rule'slogkey. - Two cases are refused, each naming what it is:
- an entry with no promise, under a rule with no
tsa(Rekor v2 gives an inclusion proof and a time from a separate timestamp service: the rule must name that service's root astsa); - any other kind.
- an entry with no promise, under a rule with no
- The bundle's first
- The time is the promise's
integratedTimewhen the entry has a promise, never the node's clock. For an entry with no promise (Rekor v2), under a rule withtsa, it is the earliest genTime of its RFC 3161 timestamps, once every one verifies against the rule'stsa. Under a rule withtsa, a v1 bundle needs the timestamp to be present and to verify, but its time is not used: the check still takes the promise's time (presence-only for v1). The ten-minute certificate is good only then. - The chain.
webpki::EndEntityCert::verify_for_usageis called with:- the
authoritycertificates as anchors; - ECDSA P-256/SHA-256 and P-384/SHA-384 (Fulcio's leaf and intermediate signatures) as the algorithms;
- the time from step 3;
KeyUsage::required(id-kp-codeSigning 1.3.6.1.5.5.7.3.3);- no revocation list.
- the
- webpki refuses a certificate outside its validity at that time, one not for code signing, one not signed by an anchor, and an unknown extension marked critical. Unknown extensions that are not critical (Fulcio's 57264.1.* and the SCT) are ignored.
- The identity.
- Neither field is read by webpki, so a small DER reader in
keyless.rsreads them from the leaf's extensions:- The subject is
subjectAltName(2.5.29.17): its one rfc822Name[1]or URI[6], as UTF-8. - The issuer is 1.3.6.1.4.1.57264.1.8, a DER UTF8String. If that is missing, the deprecated 1.3.6.1.4.1.57264.1.1, whose bytes are the string itself, is used.
- The subject is
- Both must equal the rule's. A certificate with more than one name, or with neither extension, is refused.
- The reader checks every length against what is left, uses no index without a check, and is fed cut and altered certificates in a test.
- Neither field is read by webpki, so a small DER reader in
- The signature.
- Bundle.
dsseEnvelopehas a payloadType ofapplication/vnd.in-toto+json,payload(base64) and onesignatures[0].sig. The bytes checked are the DSSE PAE:"DSSEv1 " len(type) " " type " " len(payload) " " payload, with the lengths in decimal ASCII. - Tag. The bytes checked are the layer's bytes, cosign's simple-signing JSON. The signature is
dev.cosignproject.cosign/signature. - Either signature is checked with the leaf's key:
EndEntityCert::verify_signaturewith ECDSA P-256/SHA-256 ASN.1, or P-384/SHA-384.
- Bundle.
- The digest.
- Bundle. The payload is an in-toto Statement whose
_typeishttps://in-toto.io/Statement/v1and whosepredicateTypeishttps://sigstore.dev/cosign/sign/v1. One of itssubject[].digest.sha256must be the digest's hex. (The referrer'ssubjectwas checked too, under "Where signatures are looked for".) - Tag. The payload is
critical.image.docker-manifest-digest, the same check as today.
- Bundle. The payload is an in-toto Statement whose
- That the log's entry is this signature's. The promise covers
canonicalizedBody, so that body is read and compared:dsse 0.0.1:spec.signatures[0].signaturemust equal the envelope's signature,spec.signatures[0].verifier(base64 PEM) must equal the leaf's DER, andspec.payloadHash.valuemust be SHA-256 of the payload.hashedrekord 0.0.1:spec.signature.contentmust equal the signature,spec.signature.publicKey.contentmust equal the leaf's DER, andspec.data.hash(sha256) must be SHA-256 of what was signed: the payload for the tag, and the PAE for a bundle.- A mismatch is refused as "the log's entry is of another signature".
A signature that passes is remembered with the image as <subject> (<issuer>) #<hash>, the hash covering all four fields, the way a key is remembered by its id.
What is not checked, and why #
- The log's inclusion proof and checkpoint. These are signed by the same log key as the promise. With no witness and no monitor to compare against, a proof against that key's own checkpoint proves nothing more offline than its promise. If a witness is ever named, this is where it goes.
- The authority's own log proof (the SCT in the certificate). It would need the certificate-transparency log's key, a second key to give. The promise already shows the log saw the certificate within its validity.
- Revocation. There is none for a ten-minute certificate. The time from the log is what bounds it.
- Rekor v2 (no promise; a timestamp authority's RFC 3161 token instead). Without a timestamp, or under a rule with no
tsa, it is refused, naming it.keyless::timestampreads each token in the bundle (timestampVerificationData, at most 4) and takes the earliest genTime as the signing time when, for every token, the TSA's signature over the signed attributes, their messageDigest, the SHA-256 imprint of the signature, and a chain to one of the TSA roots given (EKU timeStamping, valid at genTime) all hold; the signer's certificate must then be valid at that time. The log's inclusion proof is not read. The rule field that carries the TSA root is the identity'stsa:keyless::verifyis what callstimestamp, per identity, and forgets what it found before the next identity is asked. The token is read as DER only, of at most 16 KiB, nested at most 10 deep (not counting what a certificate or an attribute's values hold; 10 because the signer's issuer Name, in a real TSA's SignerInfo, reaches depth 9), with at most 4 certificates; past a limit, in BER, or with a length written longer than DER needs, it is refused naming which. cosign 3 still logs to Rekor v1 by default on the public instance (sigstore blog, "Rekor v2 GA", Oct 2025). - A log that lies along with the authority. This is not caught: who runs them is the owner's choice of trust, and README and SECURITY.md say so.
Rivals #
- The sigstore crate (sigstore-rs) has a verifier, but it pulls in openssl-free-but-large crates (x509-cert, p256, tough's TUF) and a cosign client with its own HTTP stack. Against kithd's 13.00 MB budget, the few hundred lines here are cheaper. It also fetches its trust roots through TUF by default, which this design rules out.
- A full x509 parser (
x509-parserorx509-cert) to read the two fields. It is not in the tree, and webpki already checks the chain. A reader for two extensions is about 60 lines. - Trusting the public instance by a root built in. Ruled out in the brief: it can't be rotated by the owner, and every kith would trust a service nobody chose.
- Identities as a new field beside
signedBy. An older kithd ignores an unknown field and would run the image on keys alone, or unsigned. Keeping them insidesignedBymakes an older kithd refuse instead.
Review (adversary lens, before code) #
Each question below was asked of the design above.
- A signature from someone else's certificate under the same authority? The identity is checked from the certificate that verified the signature (step 5 on the step-4 leaf, and step 6 with that leaf's key). Both fields are matched whole.
- A valid old certificate replayed? The time comes from a promise signed by the log's key over a body that holds this signature and this certificate (step 8). Taking a real promise for another signature fails step 8.
- An expired certificate with a forged time? The time is inside bytes signed by the log key, and a time cannot be chosen without that key.
- A bundle for another image? Steps 7 and the referrer's subject both bind the digest. The tag's payload binds it as today.
- An intermediate that is not a CA, or that has path constraints? webpki enforces basicConstraints and path length.
- A certificate whose SAN holds a DNS name and an email? Exactly one name of the two kinds is allowed, so anything else is refused.
- Resource use? The bundle is capped at 64 KiB, there are at most 32 referrers and 32 layers, as now, and every DER length is checked before it is used.
- Two kinds of entry with the same promise? The kind is inside the signed body (
kind/apiVersionofcanonicalizedBody), so it is read from the body, not from the bundle'skindVersionalone. - Found: JCS needs no general canonicalizer. The four keys are known, and the values are a base64 string, two integers and a hex string, so the bytes are built by
format!and are exact for these. That is enough only while the body is a base64 string, which it is in both formats. Kept as written.
The independent review, and what came of it #
A second reviewer read this record and the first code. They found no way to run an image the rule refuses. They did find the following, and each is now in the code:
- Referrers. Only descriptors of the bundle's kind and of a bundle's size are taken, and the cap of 32 applies after that filter. A registry that answers with something else, or that has no referrers API, counts as having none, and the tag is looked at next. The whole search for signatures stops at 60 s.
- A rule of identities alone goes to the node in the same list as keys, so it is never an empty list that runs unsigned. A test pulls an unsigned image under such a rule and sees it refused.
- Envelopes. A
payloadTypeother thanapplication/vnd.in-toto+jsonis refused. A statement of any kind other thanhttps://sigstore.dev/cosign/sign/v1, such as an attestation, is refused as "no signature". - Repeated extensions. A certificate that holds the same extension twice is not read.
- Registry text in refusals. Any text a registry gave that a refusal repeats is cut to 80 characters, with control characters removed.
- Left for its own task: manifests and the referrers index are read whole by oci-client, and an outside registry has no timeout of its own. Both were true for every pull before this change.
Checked against a real bundle: keyless_real_bundle_from_cosign_verifies_against_its_own_roots reads an attestation that cosign wrote with the public instance. It checks it against that instance's trusted root. The log's promise (the JCS bytes), the dsse entry's binding, the certificate's chain to Fulcio at the log's time, and the issuer and subject all hold. Only its statement, which is an attestation, is refused.