What is the difference between cosign sign and cosign sign-blob, and who stores the result?
answer
- two commands, two kinds of subject
- one talks to a registry
- the other hands you files
- bundle is yours to distribute
- log records events, not artifacts
basics
~20 scosign sign signs an artifact already in an OCI registry, addressed by its digest, and pushes the signature back there. cosign sign-blob signs any local file and hands the signature material back to you to store and ship yourself.
solid answer
~50 s`cosign sign` targets something already in an OCI registry: you give it a reference, the subject of the signature is the artifact's `sha256:` digest, and cosign pushes the resulting signature into the registry next to it, so a verifier only needs the same reference. `cosign sign-blob` targets an ordinary file on disk. No registry is involved, so cosign prints the signature and, in keyless mode, the certificate, and with `--bundle` writes a single file containing the signature, the certificate and the transparency-log entry. That bundle is now *your* distribution problem: whoever consumes the file needs it alongside, and `cosign verify-blob --bundle` is how they check it. Both forms use the same identity chain, and both can instead use a key pair with `--key`. Practically: registry artifacts get `sign`, loose files like model checkpoints, installers or OS packages get `sign-blob`.
go deeper
Be ready to say which command applies to a registry artifact and which to a file on disk, and that sign-blob leaves you holding the signature material.
Explain that the signature's subject is the content digest, what a bundle file actually contains, and why verify-blob needs it supplied explicitly.
Show the operational consequence: a verifier that treats absent signature material as a pass is the failure mode, so design the load or install path to fail closed.
Own the decision of what gets signed at all across artifact kinds — registry images, OS packages, model files — and who is accountable for carrying bundles through every hop of distribution.
## The two commands answer different questions about *where the artifact lives* cosign is Sigstore's command-line tool for signing and verifying artifacts. Its subcommands split along a single axis: is the thing you want to sign an object in an OCI registry, or is it a file? ### `cosign sign` — registry-resident artifacts You hand it a registry reference. The subject of the signature is the artifact's content digest (`sha256:...`), not its tag — a tag is a mutable name, a digest is the content. cosign then pushes the signature material into the same registry, so distribution is solved for you: anyone who can pull the artifact can also fetch its signature, and `cosign verify` on the same reference finds it. Because the subject is a digest, signing a tag is a slightly dangerous convenience: cosign resolves the tag to whatever digest it points at *at that moment*, and if the tag moves afterwards the signature does not follow it. Signing and verifying by digest removes that whole class of confusion. ### `cosign sign-blob` — anything else A training checkpoint, a `.deb`, an RPM, a release tarball, an installer script: none of these are registry objects, and `sign-blob` exists for them. It hashes the file, signs the hash, and gives the result back to you as output rather than pushing it anywhere. In keyless mode you get a signature and the short-lived certificate that binds the signing public key to an OIDC identity. `--bundle <file>` collects the signature, the certificate and the transparency-log entry into one file, which is far easier to move around than three separate strings. The verifier counterpart is `cosign verify-blob`, which needs the file, the bundle (or the separate signature and certificate), and the identity you expect. ### Who keeps the material — the part candidates miss With `sign`, the registry keeps it. With `sign-blob`, *you* keep it. Nothing stores it on your behalf: the transparency log records that a signing event happened over a given hash, but it is a log, not artifact storage, and it will not serve your bundle back as a distribution channel. If the bundle is lost, the artifact is unverifiable even though it was legitimately signed. A concrete shape: a data-science platform signs training checkpoints with `sign-blob --bundle` in the job that produces them, and uploads the checkpoint and the bundle together to an object-storage bucket. The loader verifies before deserialising anything. The platform-operations group can also write that bucket, and that is exactly the point — an operator who swaps a checkpoint cannot produce a bundle that verifies against the training job's identity, because they cannot obtain a certificate for that identity. What they *can* do is delete the bundle, so the loader must fail closed when signature material is missing rather than treating "no bundle" as "nothing to check". Storing artifact and bundle in the same bucket is not itself the weakness; treating a missing bundle as a pass is. ### Keys versus keyless Both commands work either way. With `--key`, you supply a key pair and inherit the job of generating, storing and rotating the private key. Without it, cosign runs the keyless flow: an OIDC token is exchanged for a short-lived certificate bound to that identity, and the signing event is recorded in a transparency log. The command shapes above are identical in both modes; only what the verifier pins changes — a public key in one case, an expected identity and issuer in the other. ### What neither command does Neither one inspects the artifact. Signing is an assertion of origin, not a quality judgement: a signature says *who vouched for these exact bytes*. It does not say the artifact is free of vulnerabilities, that it was built from reviewed source, or how it was produced. Those are different claims carried by different mechanisms.
- Why sign the digest rather than the tag when you run cosign sign?A digest is derived from the content, so a signature over it can only ever apply to those exact bytes. A tag is a mutable pointer: cosign resolves it at signing time, and if someone repoints the tag afterwards the signature stays with the old digest. Signing and verifying by digest removes the window where a verifier and a signer disagree about what the name means.
- Your checkpoint bundle is stored in the same bucket as the checkpoint. Is that a problem?Co-location is fine on its own: an attacker with write access cannot forge a bundle that verifies against your training job's identity, because they cannot obtain a certificate for it. The real risk is deletion — if they remove the bundle and your loader treats missing signature material as "nothing to verify", they win. Fail closed instead.
- Does cosign sign-blob upload the file anywhere?No. It hashes the file locally, signs the hash, and returns the signature material. The artifact bytes never leave your machine, and the transparency log records only the hash and the signing metadata. Distribution of both the file and its bundle stays entirely yours.
saying these in an interview costs you the question
- Says sign-blob also pushes the signature into a registry
- Thinks the artifact itself is uploaded to the transparency log
- Treats a tag reference as equivalent to a digest
- Assumes a missing bundle means there is nothing to verify
- Claims a signature means the artifact was scanned and is safe