Synopsis
Build systems produce in-toto attestations as they build:
actions/attest, cosign attest
and docker buildx --provenance --sbom among them. This command records one in Kosli,
verifying its signature first, rather than regenerating the same evidence with other
kosli attest commands.
--predicate-type chooses what to record, one kind per command:
provenance(SLSA provenance v1 or v0.2) reports the artifact named by--name, askosli attest artifactdoes. The commit, branch, repository and build URL come from the statement, never from the CI environment, so the build’s own commit and run are recorded even when this command runs in a different job or workflow.sbom(SPDX or CycloneDX) reports an SBOM attestation named by--name, askosli attest sbomdoes, with the attestation attached in place of the SBOM file.
--source chooses where the attestation is read from:
githubreads the attestations GitHub holds for the artifact, whereactions/atteststores them, in the repository given with--github-organd--repository, or with--repositoryalone asowner/name. It needs--github-token, with theattestations: readpermission. It is the default when running in GitHub Actions. GitHub holds them by the digest that was attested, so name an image by the digest the build pushed, asyourImageName@sha256:...with--artifact-type oci, or give that digest with--fingerprint: a tag may since have moved to another image.bundlereads the file given with--bundle: a Sigstore bundle (.sigstore.json), a DSSE envelope, an in-toto statement, or an.intoto.jsonlfile with one of these per line. It is the default elsewhere, and whenever--bundleis given.
--certificate-identity (or
--certificate-identity-regexp) with --certificate-oidc-issuer, or --key. There is no
way to accept any valid certificate. An unsigned attestation is refused unless
--allow-unsigned is given, and is then recorded as unverified.
With --source github in GitHub Actions, a signer you do not pin defaults to a workflow in
the repository itself, for an attestation made by the run this command is part of: the
issuer https://token.actions.githubusercontent.com, an identity starting
https://github.com/owner/repository/.github/workflows/, and a certificate issued
to that run, in any of its attempts. The identity alone is not enough to trust. It matches
the workflow file on any branch or pull request, so anyone who can push a branch could
attest the artifact with a predicate of their own. When the run made no attestation of
the artifact, the command fails and names the flags that pin a signer. Pin the signer
yourself, to the workflow file and the ref it runs on, to record an attestation another run
made, such as from a deployment workflow, or one a reusable workflow in another repository
signed. There is no default outside GitHub Actions, when --github-base-url is given, or
when the run is on a server other than github.com, and the command stops before reading
anything unless a signer is pinned.
In a file, an attestation that fails verification, because another signer made it or it
was changed after signing, fails the command and nothing is recorded, even when another
attestation in the file would qualify. So does a signed attestation whose signature cannot
be checked, such as when no signer is pinned, a trust root cannot be fetched or the signer
flags do not fit how it was signed; the error then says it could not be verified, not that
it failed. So does an entry of the file that cannot be read as an attestation. GitHub
holds the attestations of every workflow that attested the artifact, so there such an
attestation, or one that cannot be downloaded or read, is passed over with a warning as
long as another one verifies. When none does, the command fails, naming each one, and
nothing is recorded.
Verifying a certificate-signed attestation needs the trust root of the Sigstore instance
that signed it: Sigstore’s public-good instance, or GitHub’s own, which signs attestations
for private repositories. It is fetched over TUF on every run that verifies one, from
https://tuf-repo-cdn.sigstore.dev or https://tuf-repo.github.com respectively, and
cached under ~/.sigstore, so the runner needs outbound HTTPS to that host and a writable
~/.sigstore directory. A key-signed attestation needs neither, unless it carries a
transparency log entry or a signed timestamp, which are checked against Sigstore’s
public-good trust root. An unsigned attestation needs neither.
The record is annotated with verified and, for a signed attestation, signer_identity,
signer_issuer, log_index, integrated_time and signed_timestamp where they apply.
Provenance adds builder_id, build_type and workflow, and an SBOM adds sbom_format
and sbom_sha256. The attestation external URL links the attestation’s transparency
log entry, pinned by the SHA-256 of the attestation’s bytes. An attestation read from
GitHub that has no entry in a public log, as in a private repository, links GitHub’s API
listing of the artifact’s attestations instead. Reading that listing needs a token, and it
holds every attestation of the artifact, so it is recorded without a fingerprint.
For provenance, the commit’s message, author and time are looked up on GitHub with
--github-token when the statement names a GitHub repository, or else read from the git
checkout at --repo-root if it holds the commit. Failing both, only the commit’s SHA is
recorded, without its details or branch. A repository on GitHub Enterprise Server needs
--repo-provider github and --github-base-url to be looked up there: the token is only
sent to github.com or the server you name, never to a host taken from the statement or to
the storage GitHub serves a bundle from. A build URL or commit URL the statement does not
carry can be given with --build-url and --commit-url.
The artifact fingerprint can be provided directly with the --fingerprint flag, or
calculated based on --artifact-type flag.
Artifact type can be one of: “file” for files, “dir” for directories, “oci” for container
images in registries or “docker” for local docker images.
Note: --artifact-type=docker reads the image’s repo digest via the local Docker daemon.
The image must have been pushed to or pulled from a registry for a repo digest to exist;
a freshly built image (just docker build) will not have one. If the image is already in
a registry, prefer --artifact-type=oci, which fetches the digest directly from the
registry without needing a local Docker daemon.
For --artifact-type=oci (and for --artifact-type=docker when --registry-username
is set), registry credentials are resolved as follows:
- If
--registry-username(and optionally--registry-password) is set, it is used directly. - Otherwise, credentials are discovered automatically from:
- the Docker config file (
~/.docker/config.json, populated bydocker login) - the Podman/containers auth file (
~/.config/containers/auth.json, or$REGISTRY_AUTH_FILE) - any Docker credential helper configured in that config (e.g.
docker-credential-ecr-loginfor AWS ECR,docker-credential-gcloudfor GCR/Artifact Registry, an ACR helper for Azure, or a local keychain helper), invoked as an external binary on$PATH - if none of the above yield credentials, the registry is accessed anonymously, which works
for public images
--registry-provideris deprecated and no longer used.
- the Docker config file (
.kosli_ignore file to the root of the artifact.
Each line should specify a relative path or path glob to be ignored. You can include comments in this file, using #.
The .kosli_ignore file is always treated as part of the artifact: its own entries cannot exclude it, so the exclusion list cannot be changed without changing the fingerprint.
Paths the list already matches stay excluded whatever is later added there, so keep its entries as narrow as possible.
Excluding the file with --exclude keeps it out of the fingerprint but still applies the paths it lists, which lets a writable directory change the list again.
To drop the file from the fingerprint safely, move its entries to --exclude and delete it.
Flags
Flags inherited from parent commands
Examples Use Cases
These examples all assume that the flags--api-token, --org, --host, (and --flow, --trail when required), are set/provided.
in the GitHub Actions run that built an image, record the SLSA provenance actions/attest stored for it,
in the GitHub Actions run that built an image, record the SLSA provenance actions/attest stored for it,
as the artifact named app. The image is named by the digest the build pushed, such as
as the artifact named app. The image is named by the digest the build pushed, such as
ghcr.io/yourOrg/yourImage@sha256:0123...
ghcr.io/yourOrg/yourImage@sha256:0123...
record the SBOM attestation stored for the same image, as app.sbom
record the SBOM attestation stored for the same image, as app.sbom
in another run, such as a deployment, or outside GitHub Actions, read a repository's attestations
in another run, such as a deployment, or outside GitHub Actions, read a repository's attestations
and pin the workflow that signed them, with the ref it ran on.
and pin the workflow that signed them, with the ref it ran on.
Giving the digest as the fingerprint skips reading it from the registry
Giving the digest as the fingerprint skips reading it from the registry
record verified SLSA provenance from a Sigstore bundle, as the artifact named app
record verified SLSA provenance from a Sigstore bundle, as the artifact named app
record the SBOM attestation from the same build, as app.sbom
record the SBOM attestation from the same build, as app.sbom
record unsigned provenance written by docker buildx, marked as unverified
record unsigned provenance written by docker buildx, marked as unverified