-
Notifications
You must be signed in to change notification settings - Fork 220
Discover cosign v3 NewBundleFormat for verification #1961
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: leigh capili <[email protected]>
|
This quick script:
The script also does a quick Using this script, you can prime the two local registries with testdata that functions with the next commit. #!/usr/bin/env bash
docker run -d --restart=unless-stopped -p "127.0.0.1:5558:5000" --name cosign_zot ghcr.io/project-zot/zot:latest
docker run -d --restart=unless-stopped -p "127.0.0.1:5559:5000" --name cosign_registry registry:2
sleep 2
#cosign initialize --staging
echo | COSIGN_PASSWORD= cosign generate-key-pair
function mk_config() {
name="$1"
port="$2"
mkdir -p $name
kubectl create cm --dry-run=client -oyaml $name > $name/cm.yaml
flux push artifact --path ./$name oci://localhost:$port/$name --source dev --revision $name
v3_args=
if [[ $name == *"envelope"* ]]; then
v3_args="--new-bundle-format=false --use-signing-config=false"
fi
if [[ $name == *"v2"* ]]; then
echo y | COSIGN_PASSWORD= flox activate -d ~/hack/cosign-v2 -- cosign sign --key cosign.key localhost:$port/$name
fi
if [[ $name == *"v3"* ]]; then
echo y | COSIGN_PASSWORD= flox activate -d ~/hack/cosign-v3 -- cosign sign $v3_args --key cosign.key localhost:$port/$name
fi
crane ls localhost:$port/$name
}
mk_config v2-reg 5559
mk_config v2-zot 5558
mk_config v2-v3-envelope-reg 5559
mk_config v2-v3-envelope-zot 5558
mk_config v2-v3-bundle-reg 5559
mk_config v2-v3-bundle-zot 5558
mk_config v3-envelope-reg 5559
mk_config v3-envelope-zot 5558
mk_config v3-bundle-reg 5559
mk_config v3-bundle-zot 5558
echo
echo v2-reg
crane ls localhost:5559/v2-reg
echo
echo v2-zot
crane ls localhost:5558/v2-zot
echo
echo v2-v3-envelope-reg
crane ls localhost:5559/v2-v3-envelope-reg
echo
echo v2-v3-envelope-zot
crane ls localhost:5558/v2-v3-envelope-zot
echo
echo v2-v3-bundle-reg
crane ls localhost:5559/v2-v3-bundle-reg
echo
echo v2-v3-bundle-zot
crane ls localhost:5558/v2-v3-bundle-zot
echo
echo v3-envelope-reg
crane ls localhost:5559/v3-envelope-reg
echo
echo v3-envelope-zot
crane ls localhost:5558/v3-envelope-zot
echo
echo v3-bundle-reg
crane ls localhost:5559/v3-bundle-reg
echo
echo v3-bundle-zot
crane ls localhost:5558/v3-bundle-zot |
|
WIP tests pushed in bb1c8fb. It passes locally! 🙂 They are not expected to pass in CI. I tried using Zot pkgs to create an OCI 1.1 compliant registry: "zotregistry.dev/zot/v2/pkg/api"
"zotregistry.dev/zot/v2/pkg/api/config"but they pull in a lot of undesirable dependencies, require replaces, and the real kicker is some of the deps need CGO, so I ditched the effort of adding another |
|
Looks like i missed this, need to fix: |
matheuscscp
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this!
| "github.com/sigstore/cosign/v3/cmd/cosign/cli/rekor" | ||
| "github.com/sigstore/cosign/v3/pkg/cosign" | ||
| "github.com/sigstore/cosign/v3/pkg/oci" | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit
| opts.NewBundleFormat = true | ||
| signatures, _, err = cosign.VerifyImageAttestations(ctx, ref, &opts) | ||
| } | ||
| fmt.Println(opts.NewBundleFormat, v.opts.NewBundleFormat) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops
| } | ||
|
|
||
| checkOpts := &cosign.CheckOpts{} | ||
| checkOpts.NewBundleFormat = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line seems unneeded since we're assigning the value of this field for each case inside Verify()?
v2 signatures and v3 bundled signatures both function transparently. This does require additional queries to the registry. Signed-off-by: leigh capili <[email protected]>
…ation Signed-off-by: leigh capili <[email protected]>
2f282b2 to
8f083f5
Compare
With this change Flux can verify signatures issued from both the
cosign v2.x and v3.x CLI's when using their respective default signing settings/flags.
v2 signatures and v3 bundle signatures both function transparently.
This does require Flux to perform additional queries to the registry.
Fixes #1923
Carries on from #1924