feat(lab8): cosign sign + SBOM/provenance attestations + blob signing - #8
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Goal
Sign the Juice Shop image with Cosign, attach SBOM + provenance attestations, and demonstrate blob signing as a mitigation for tag-mutation and unsigned-artifact supply-chain attacks (Codecov 2021 class).
Changes
labs/lab8/keys/cosign.pubβ public key used for all verify/verify-attestation/verify-blob operationssubmissions/lab8.mdβ full writeup: sign + tamper demo, SBOM/provenance attestations, bonus blob signingTesting
Registry + image push
docker run -d --name lab8-registry -p 127.0.0.1:5000:5000 registry:3
docker tag bkimminich/juice-shop:v20.0.0 localhost:5000/juice-shop:v20.0.0
docker push localhost:5000/juice-shop:v20.0.0
Sign + verify original digest
cosign sign --key labs/lab8/keys/cosign.key --yes "$DIGEST"
cosign verify --key labs/lab8/keys/cosign.pub --insecure-ignore-tlog "$DIGEST"
β Verified OK, docker-manifest-digest matches sha256:8c76bce9...
Tamper demo (alpine re-tagged as juice-shop)
cosign verify --key labs/lab8/keys/cosign.pub --insecure-ignore-tlog "$TAMPERED_DIGEST"
β Error: no signatures found (correctly rejected)
Sanity recheck β original still verifies after tamper attempt
cosign verify --key labs/lab8/keys/cosign.pub --insecure-ignore-tlog "$DIGEST"
β Verified OK
SBOM attestation
cosign attest --key labs/lab8/keys/cosign.key --type cyclonedx --predicate labs/lab4/juice-shop.cdx.json --yes "$DIGEST"
cosign verify-attestation --key labs/lab8/keys/cosign.pub --insecure-ignore-tlog --type cyclonedx "$DIGEST"
diff <(jq -S '.components | length' labs/lab4/juice-shop.cdx.json)
<(jq -S '.components | length' labs/lab8/results/sbom-from-attestation.json)
β empty diff, both 3069 components
Provenance attestation
cosign attest --key labs/lab8/keys/cosign.key --type slsaprovenance --predicate /tmp/predicate-only.json --tlog-upload=false --yes "$DIGEST"
cosign verify-attestation --key labs/lab8/keys/cosign.pub --insecure-ignore-tlog --type slsaprovenance "$DIGEST"
β verified, builder.id = https://localhost/lab8-student
Bonus: blob signing
cosign sign-blob --key labs/lab8/keys/cosign.key --yes --bundle labs/lab8/results/my-tool.tar.gz.bundle labs/lab8/results/my-tool.tar.gz
cosign verify-blob --key cosign.pub --bundle my-tool.tar.gz.bundle --insecure-ignore-tlog my-tool.tar.gz
β Verified OK
Tamper test on blob
echo "MALICIOUS PAYLOAD" >> my-tool.tar.gz
cosign verify-blob --key cosign.pub --bundle my-tool.tar.gz.bundle --insecure-ignore-tlog my-tool.tar.gz
β Error: invalid signature when validating ASN.1 encoded signature (correctly rejected)
Artifacts & Screenshots
submissions/lab8.mdβ full task writeup with all verification outputsChecklist
feat(labN): <topic>stylesubmissions/lab8.md