Skip to content

Missing SLSA provenance and cosigns, scripts to detect #32207

Open
@scop

Description

What

I wrote two ugly and naive scripts to check for missing SLSA provenance and cosign configs.

cosigns.sh

#!/bin/sh

# gh api '/search/code?q="cmd:+cosign"+filename:.goreleaser.yml+filename:.goreleaser.yaml+path:/' -H Accept:application/vnd.github+json -H X-GitHub-Api-Version:2022-11-28 --paginate >cosigns.json

# ^this is naturally just goreleaser things, I'm sure some other useful queries for this could be constructed.
# But it's a start, and already finds a bunch of omissions.

for repo in $(jq -r ".items.[].repository.full_name" <cosigns.json | sort -u); do
    test -f "pkgs/$repo/registry.yaml" || continue
    grep -LF cosign: "pkgs/$repo/registry.yaml"
done

slsas.sh

#!/bin/sh

# gh api /search/code?q=slsa-framework/slsa-github-generator/.github/workflows+path:.github/workflows' -H Accept:application/vnd.github+json -H X-GitHub-Api-Version:2022-11-28 --paginate >slsas.json

for repo in $(jq -r ".items.[].repository.full_name" <slsas.json | sort -u); do
    test -f "pkgs/$repo/registry.yaml" || continue
    grep -LF slsa_provenance: "pkgs/$repo/registry.yaml"
done

Output from gh could naturally be piped directly in instead of asking to be stored in separate files per the comments, but I did this for iterating over the script implementations a bit.

It should also be noted that running the gh commands will drain one's GH REST API rate limit due to --paginate and many results.

Perhaps these would be useful enough to be somehow included in aqua-registry or serve as basis for better implementations. See note below for current output on my system.

Why

Better SLSA and cosign coverage.

Note

$ ./slsas.sh
jq: error (at <stdin>:0): Cannot iterate over null (null) # this is because I exceeded my GH REST API rate limit and the JSON ended up having that error in it
pkgs/argoproj/argo-rollouts/registry.yaml
pkgs/fission/fission/registry.yaml
pkgs/google/go-containerregistry/registry.yaml
pkgs/google/mtail/registry.yaml
pkgs/jreleaser/jreleaser/registry.yaml
pkgs/kptdev/kpt/registry.yaml
pkgs/kyverno/kyverno/registry.yaml
pkgs/restic/restic/registry.yaml
pkgs/slsa-framework/slsa-verifier/registry.yaml
pkgs/xeol-io/xeol/registry.yaml
$ ./cosigns.sh
pkgs/abhimanyu003/sttr/registry.yaml
pkgs/a-h/templ/registry.yaml
pkgs/bitnami-labs/sealed-secrets/registry.yaml
pkgs/carvel-dev/imgpkg/registry.yaml
pkgs/carvel-dev/kapp/registry.yaml
pkgs/carvel-dev/kbld/registry.yaml
pkgs/carvel-dev/vendir/registry.yaml
pkgs/carvel-dev/ytt/registry.yaml
pkgs/cert-manager/cmctl/registry.yaml
pkgs/FairwindsOps/gonogo/registry.yaml
pkgs/FairwindsOps/pluto/registry.yaml
pkgs/FairwindsOps/polaris/registry.yaml
pkgs/FairwindsOps/rbac-lookup/registry.yaml
pkgs/fission/fission/registry.yaml
pkgs/fluxcd/flux2/registry.yaml
pkgs/google/yamlfmt/registry.yaml
pkgs/helm/chart-releaser/registry.yaml
pkgs/helm/chart-testing/registry.yaml
pkgs/kubepug/kubepug/registry.yaml
pkgs/kyverno/kyverno/registry.yaml
pkgs/loft-sh/vcluster/registry.yaml
pkgs/orlangure/gocovsh/registry.yaml
pkgs/purpleclay/dns53/registry.yaml
pkgs/securego/gosec/registry.yaml
pkgs/sigstore/gitsign/registry.yaml
pkgs/sigstore/rekor/registry.yaml
pkgs/smallstep/certificates/registry.yaml
pkgs/smallstep/cli/registry.yaml
pkgs/stacklok/frizbee/registry.yaml
pkgs/stackrox/kube-linter/registry.yaml
pkgs/suzuki-shunsuke/ghalint/registry.yaml
pkgs/suzuki-shunsuke/pinact/registry.yaml
pkgs/suzuki-shunsuke/sort-issue-template/registry.yaml
pkgs/suzuki-shunsuke/tfaction-go/registry.yaml
pkgs/terramate-io/terramate/registry.yaml
pkgs/tofuutils/tenv/registry.yaml
pkgs/Trendyol/kink/registry.yaml
pkgs/trufflesecurity/trufflehog/registry.yaml
pkgs/twpayne/chezmoi/registry.yaml

SLSA

Cosign

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions