1
0
mirror of synced 2026-10-24 12:59:22 +03:00

39 Commits

Author SHA1 Message Date
Colleen Murphy
645636e07c Remove sign_blob_test.sh test (#3707)
The bug that this test was meant to address[1] applies to a feature that
was removed from cosign[2]. The updates made to the script to allow for
the breaking changes actually make the test invalid, because while it
was once verifying the original artifact signature, the final
verification step is now actually verifying against the uploaded rekor
entry, so the original signature is inconsequential.

[1] https://github.com/sigstore/cosign/pull/1673
[2] https://github.com/sigstore/cosign/pull/2425

Signed-off-by: Colleen Murphy <colleenmurphy@google.com>
2024-05-20 15:28:12 -07:00
Colleen Murphy
302aee6c16 Refactor e2e-tests.yml workflow (#3627)
* Move attach e2e tests into Go test suite

Run the e2e_test_attach.sh tests in Go, as a step toward making all the
e2e tests consistent with one another. This also has the added benefit
of no longer relying on ttl.sh since test images are hosted in the mock
registry server.

These tests were being run in CI under Linux and Mac, since they don't
rely on a Kind instance or any Sigstore services. This change updates
the GitHub workflow for the attach tests to simply run all e2e tests
that are compatible with the macos runner.

Signed-off-by: Colleen Murphy <colleenmurphy@google.com>

* Reorganize cross-platform attach tests

Move all the e2e tests for cosign attachments that can be run
independently without other Sigstore services into the new
e2e_attach_test.go file, to make the main e2e_test.go file a more
mantainable size and to get the benefit of running these tests in the
e2e-cross job which runs on macos and linux.

Signed-off-by: Colleen Murphy <colleenmurphy@google.com>

* Move TSA MTLS tests into Go test suite

Run the e2e_tsa_mtls.sh tests in Go. With this, a separate step to run
the script is unnecessary for the Github workflow, since it will be run
as part of the e2e-cross job.

Signed-off-by: Colleen Murphy <colleenmurphy@google.com>

* Move TSA blob tests into Go test suite

Run the e2e_signblob_tsa_mtls.sh tests in Go. The e2e-tsa-mtls job in
the e2e-tests workflow is fully removed since these are now all covered
in e2e-cross.

Signed-off-by: Colleen Murphy <colleenmurphy@google.com>

---------

Signed-off-by: Colleen Murphy <colleenmurphy@google.com>
2024-04-09 11:11:18 -07:00
Dmitry Savintsev
d96e3794e8 fix 'go vet -tags e2e ./...' (#3550)
* fix 'go vet -tags e2e ./...'

Signed-off-by: Dmitry S <dsavints@gmail.com>

* fix typo in 'concatenating'

Signed-off-by: Dmitry S <dsavints@gmail.com>

---------

Signed-off-by: Dmitry S <dsavints@gmail.com>
2024-02-22 09:12:17 -08:00
Colleen Murphy
a0b02b7d7f Make E2E tests hermetic (#3499)
* Set rekor URL for online and offline tests

Some tests were setting the REKOR_URL environment variable to try to
test offline verification. This variable is no longer read so it was not
doing anything. This change removes the variable and instead sets
RekorURL in the command to either the local rekor instance (so that the
public instance is not used) or to a bad url with Offline set to true so
that offline verification is truly tested.

This change also removes the COSIGN_EXPERIMENTAL variable which is no
longer used, and replaces os.Setenv with testing.Setenv which
localizes the environment setting to the scope of the test and removes
the need for a cleanup function.

Signed-off-by: Colleen Murphy <colleenmurphy@google.com>

* Fix cleanup in E2E script

Calling trap multiple times replaces the last signal handler rather than
appending to it. This change ensures that the most recent trap includes
all previous traps so that all cleanups are executed.

Signed-off-by: Colleen Murphy <colleenmurphy@google.com>

* Move verify tests from shell script to Go suite

Move the `cosign dockerfile verify` and `cosign manifest verify` tests
out of the shell script and into the e2e Go test suite file with all the
other tests. This makes them consistent to manage.

The initialization of fulcio roots in other tests pollutes the trust
root in the new tests, so a reset is added to the fulcioroots package
for testing only.

Signed-off-by: Colleen Murphy <colleenmurphy@google.com>

* Use local services for verify tests

Update TestDockerfileVerify and TestManifestVerify to sign ephemeral
images within the tests so that the signatures can be created with and
verified from the locally running Fulcio and Rekor instances instead of
verifying images with the public Rekor instance, so that the tests no
longer depend on external services.

The images are signed using --identity-token to avoid changing the
nature of the verification tests, which were originally written to be
keyless. A mock OIDC server is provisioned to provide the token and
enable verification.

Signed-off-by: Colleen Murphy <colleenmurphy@google.com>

* Set rekor env variable in Go test suite

Move the setting of SIGSTORE_REKOR_PUBLIC_KEY from the e2e shell script
to the Go test suite, so that only the tests that need it have it set
and the shell script is doing less setup. Also remove unnecessary
instances of os.RemoveAll for temporary directories that the Go testing
framework will automatically clean up.

Signed-off-by: Colleen Murphy <colleenmurphy@google.com>

---------

Signed-off-by: Colleen Murphy <colleenmurphy@google.com>
2024-02-07 14:34:00 -08:00
Mukuls77
f43eb6b27a Fix race condition on verification with multiple signatures attached to image (#3486)
Fixes #3476

Signed-off-by: Mukuls77 <mukul.sharma77@gmail.com>
2024-01-25 09:57:12 -08:00
Dmitry Savintsev
f6332211b9 add 'cosign sign' command-line parameters for mTLS (#3052)
* add 'cosign sign' command-line parameters for mTLS

Add command-line parameters for key/cert/cacert used for
the connection to the TSA server.

Fixes #3006

Signed-off-by: Dmitry S <dsavints@gmail.com>

* simplify ServerName validation

Signed-off-by: Dmitry S <dsavints@gmail.com>

* add 'tsa-mtls.sh to test mTLS to TSA

Signed-off-by: Dmitry S <dsavints@gmail.com>

* add tsa mtls test to github actions

Signed-off-by: Dmitry S <dsavints@gmail.com>

* use smallstep's step to generate test certificates

Signed-off-by: Dmitry S <dsavints@gmail.com>

* in e2e_tsa_mtls.sh, build timestamp-server only if not found

Signed-off-by: Dmitry S <dsavints@gmail.com>

* add test/gencert utility, copyright

Signed-off-by: Dmitry S <dsavints@gmail.com>

---------

Signed-off-by: Dmitry S <dsavints@gmail.com>
2023-07-20 12:18:18 -04:00
Mukuls77
f1743a271e Added support for attaching cert and cert chain in attach command Git… (#2602)
* Written end to end test case for cossign attach command

Signed-off-by: Mukul Sharma (Nokia) <mukul.sharma@nokia.com>

* file contain certchain for e2e attach test

Signed-off-by: Mukul Sharma (Nokia) <mukul.sharma@nokia.com>

* file contain leaf cert for e2e attach test

Signed-off-by: Mukul Sharma (Nokia) <mukul.sharma@nokia.com>

* file contains private key of leaf cert for e2e attach test

Signed-off-by: Mukul Sharma (Nokia) <mukul.sharma@nokia.com>

* file contain root cert for e2e attach test

Signed-off-by: Mukul Sharma (Nokia) <mukul.sharma@nokia.com>

* Added instruction for generating certificates for e2e attach test script

Signed-off-by: Mukul Sharma (Nokia) <mukul.sharma@nokia.com>

* updated arguments of attach.SignatureCmd() function to include cert and cert chain

Signed-off-by: Mukul Sharma (Nokia) <mukul.sharma@nokia.com>

* removed trailing white spaces

Signed-off-by: Mukul Sharma (Nokia) <mukul.sharma@nokia.com>

* removed trailing white spaces

Signed-off-by: Mukul Sharma (Nokia) <mukul.sharma@nokia.com>

* Added support for attaching cert and cert chain in attach command

Signed-off-by: Mukul Sharma (Nokia) <mukul.sharma@nokia.com>

* executed make docgen to generate file file

Signed-off-by: Mukul Sharma (Nokia) <mukul.sharma@nokia.com>

* Resolved gofmt lint error

Signed-off-by: Mukul Sharma (Nokia) <mukul.sharma@nokia.com>

* corrected the display format to be used for commands

Signed-off-by: Mukul Sharma (Nokia) <mukul.sharma@nokia.com>

---------

Signed-off-by: Mukul Sharma (Nokia) <mukul.sharma@nokia.com>
Co-authored-by: Mukul Sharma (Nokia) <mukul.sharma@nokia.com>
2023-02-17 08:22:19 -05:00
Matt Moore
960d28f0cd Fix: Add missing schemes to cosign predicate types. (#2717)
🐛 As Billy points out in the linked issue these are not RFC 3986 complient as required by the in-toto specification.

This also creates conflicts with validation in `sigstore/policy-controller` downstream because it has started to allow RFC 3986 compliant `predicateType:` in `ClusterImagePolicy`, but these are not, so they are only accessible via their
shortnames (and shortnames have proven fraught becaused they change, like this!).

Fixes: https://github.com/sigstore/cosign/issues/2612

/kind bug

Signed-off-by: Matt Moore <mattmoor@chainguard.dev>
2023-02-14 12:01:32 -08:00
kpk47
ed437f17f9 Deprecate --certificate-email flag. Make --certificate-identity and -… (#2411)
* Deprecate --certificate-email flag. Make --certificate-identity and --certificate-oidc-issuer required for verification.

--certificate-email is now an alias for --certificate-identity. Also removed some redundant subject/issuer checking.

Signed-off-by: kpk47 <kkris@google.com>

* Make --cert-email and --cert-identity mutually exclusive

Signed-off-by: kpk47 <kkris@google.com>

* Remove --certificate-email flag

Signed-off-by: kpk47 <kkris@google.com>

* docgen

Signed-off-by: kpk47 <kkris@google.com>

* lint

Signed-off-by: kpk47 <kkris@google.com>

* lint

Signed-off-by: kpk47 <kkris@google.com>

* Enforce requiring --certificate-identity and --certificate-oidc-issuer for verification.

Signed-off-by: kpk47 <kkris@google.com>

* Move argument checks to Exec() functions.

Signed-off-by: kpk47 <kkris@google.com>

* Don't require cert-identity or cert-oidc-issuer in keyed mode

Signed-off-by: kpk47 <kkris@google.com>

* fix mismerge

Signed-off-by: kpk47 <kkris@google.com>

* Change e2e blob and attestation tests to use keys.

Signed-off-by: kpk47 <kkris@google.com>

* Add workflow_dispatch trigger to attestation e2e tests

Signed-off-by: kpk47 <kkris@google.com>

* fix e2e test

Signed-off-by: kpk47 <kkris@google.com>

* typo

Signed-off-by: kpk47 <kkris@google.com>

* typo

Signed-off-by: kpk47 <kkris@google.com>

* debugging workflow

Signed-off-by: kpk47 <kkris@google.com>

* fix attest e2e test

Signed-off-by: kpk47 <kkris@google.com>

* fix attest e2e test

Signed-off-by: kpk47 <kkris@google.com>

* removing debug print statements

Signed-off-by: kpk47 <kkris@google.com>

* test e2e keyless

Signed-off-by: kpk47 <kkris@google.com>

* remove flags to trigger error

Signed-off-by: kpk47 <kkris@google.com>

* change sign_blob e2e test to use local bundles

Signed-off-by: kpk47 <kkris@google.com>

* Add tests for missing flags

Signed-off-by: kpk47 <kkris@google.com>

* typos

Signed-off-by: kpk47 <kkris@google.com>

* typos

Signed-off-by: kpk47 <kkris@google.com>

* Move error checking into CheckVerifyOptions

Signed-off-by: kpk47 <kkris@google.com>

* unit test

Signed-off-by: kpk47 <kkris@google.com>

* Re-disable e2e sign-blob-test. It can't run on GHA

Signed-off-by: kpk47 <kkris@google.com>

* debug verify attestation test

Signed-off-by: kpk47 <kkris@google.com>

* Fix verify-attestation args

Signed-off-by: kpk47 <kkris@google.com>

* debug attestation

Signed-off-by: kpk47 <kkris@google.com>

* debug verify-blob args

Signed-off-by: kpk47 <kkris@google.com>

* fix sign-blob integration test; remove debug print statements

Signed-off-by: kpk47 <kkris@google.com>

* add regexp flags

Signed-off-by: kpk47 <kkris@google.com>

* docgen

Signed-off-by: kpk47 <kkris@google.com>

* update test cert and enable sign-blob e2e test

Signed-off-by: kpk47 <kkris@google.com>

* Remove sign-blob e2e test from workflow. It requires human interaction

Signed-off-by: kpk47 <kkris@google.com>

* re-enable sign-blob e2e test using GH credentials

Signed-off-by: kpk47 <kkris@google.com>

* fix workflow permissions

Signed-off-by: kpk47 <kkris@google.com>

* re-disable sign-blob tests. Changing workflow permissions didn't help

Signed-off-by: kpk47 <kkris@google.com>

Signed-off-by: kpk47 <kkris@google.com>
2022-12-21 14:27:05 -05:00
saso
c61504db67 fix handling of verify-attestation types for URIs (#2159)
* fix handling of verify-attestation types for URIs

Signed-off-by: Akira Saso <sasoakira6114@gmail.com>

* test: add a test to verify URI-type attestation

Signed-off-by: Akira Saso <sasoakira6114@gmail.com>

* test: fix cue used in verify-attstation

Signed-off-by: Akira Saso <sasoakira6114@gmail.com>

Signed-off-by: Akira Saso <sasoakira6114@gmail.com>
2022-08-16 10:37:51 -04:00
Carlos Tadeu Panato Junior
dbd430fce5 Fix OIDC test (#2050)
* use cosign build from head

Signed-off-by: cpanato <ctadeu@gmail.com>

* add script to sign the digests and not the tags

Signed-off-by: cpanato <ctadeu@gmail.com>

* update test script and update the flags

Signed-off-by: cpanato <ctadeu@gmail.com>

* regenerate the certificate becasue the previous expired, now it is valid for 10 years

Signed-off-by: cpanato <ctadeu@gmail.com>

* add doc in how to regenerate a certificate in case we need it again :)

Signed-off-by: cpanato <ctadeu@gmail.com>

* enable cache

Signed-off-by: cpanato <ctadeu@gmail.com>

* uncomment

Signed-off-by: cpanato <ctadeu@gmail.com>
2022-07-06 10:51:15 -05:00
Josh Dolitsky
f812aa55f6 Add cyclonedx predicate type for attestations (#1977)
* Add cyclonedx predicate type for attestations

Signed-off-by: Josh Dolitsky <josh@dolit.ski>

* Use schema vs Document for predicate URL

Signed-off-by: Josh Dolitsky <josh@dolit.ski>
2022-06-09 11:17:36 -05:00
Ville Aikas
aa700bff16 Remove policy-controller now that it lives in sigstore/policy-controller (#1976)
* Remove policy-controller now that it lives in sigstore/policy-controller.

Signed-off-by: Ville Aikas <vaikas@chainguard.dev>

* Fix the third_party due to go version mismatch.

Signed-off-by: Ville Aikas <vaikas@chainguard.dev>

* Do not try to build policy-controller.

Signed-off-by: Ville Aikas <vaikas@chainguard.dev>

* Remove policy-controller from .ko.yaml

Signed-off-by: Ville Aikas <vaikas@chainguard.dev>
2022-06-08 18:28:23 -05:00
Josh Dolitsky
2ccdb3e573 Add spdxjson predicate type for attestations (#1974)
Signed-off-by: Josh Dolitsky <josh@dolit.ski>
2022-06-08 04:46:55 -05:00
Ville Aikas
d14e774003 Separate RegExp matching of issuer/subject from strict (#1956)
* Separate RE matching of issuer/subject from strict

Signed-off-by: Ville Aikas <vaikas@chainguard.dev>

* Rename IssuerRE and SubjectRE to IssuerRegExp and SubjectRegExp.

Signed-off-by: Ville Aikas <vaikas@chainguard.dev>

* timeout at 15 minutes for e2e tests.

Signed-off-by: Ville Aikas <vaikas@chainguard.dev>

* can't have issuer/issuerRegExp and subject/subjectRegExp

Signed-off-by: Ville Aikas <vaikas@chainguard.dev>

* Fix one last regexp test.

Signed-off-by: Ville Aikas <vaikas@chainguard.dev>

* Debug timeouts.

Signed-off-by: Ville Aikas <vaikas@chainguard.dev>

* Fix the conversion too.

Signed-off-by: Ville Aikas <vaikas@chainguard.dev>

* update the v1beta1 with new fields too. Guess update-codegen does not do it.

Signed-off-by: Ville Aikas <vaikas@chainguard.dev>
2022-06-07 01:40:05 -07:00
Carlos Tadeu Panato Junior
7bc21452bf replace gcr.io/distroless/ to use ghcr.io/distroless/ (#1961)
* replace gcr.io/distroless/ to use ghcr.io/distroless/

Signed-off-by: cpanato <ctadeu@gmail.com>

* fix verify

Signed-off-by: cpanato <ctadeu@gmail.com>

* move back

Signed-off-by: cpanato <ctadeu@gmail.com>

* update

Signed-off-by: cpanato <ctadeu@gmail.com>
2022-06-06 06:36:11 -05:00
Ville Aikas
2ccb1a2073 fix: fix #1930 for AWS KMS formats (#1946)
* fix: fix #1930 for AWS KMS formats
Signed-off-by: Ville Aikas <vaikas@chainguard.dev>

* use v2 of aws go-sdk, didn't realize there was one.

Signed-off-by: Ville Aikas <vaikas@chainguard.dev>

* Fix the lint + add missing authorities section to test crds. doh.

Signed-off-by: Ville Aikas <vaikas@chainguard.dev>

* can't even
Signed-off-by: Ville Aikas <vaikas@chainguard.dev>

* Actually validate keyless ca-cert as keyref. Yikes.

Signed-off-by: Ville Aikas <vaikas@chainguard.dev>

* also v1beta1.

Signed-off-by: Ville Aikas <vaikas@chainguard.dev>
2022-06-02 10:28:39 -05:00
Hector Fernandez
b0fffb273c [cosigned] Rename cosigned references to policy-controller (#1893)
* chore: rename cosigned to policy-controller

Signed-off-by: hectorj2f <hectorf@vmware.com>

* chore: rename api groups from cosigned to policy-controller

Signed-off-by: hectorj2f <hectorf@vmware.com>

* chore: rename webhook name

Signed-off-by: hectorj2f <hectorf@vmware.com>

* chore: rename script references to cosigned

Signed-off-by: hectorj2f <hectorf@vmware.com>

* chore: use policy instead of policycontroller

Signed-off-by: hectorj2f <hectorf@vmware.com>
2022-05-20 14:26:51 -05:00
Hector Fernandez
5d87c9dd26 chore: remove regex from image pattern (#1873)
Signed-off-by: hectorj2f <hectorf@vmware.com>
2022-05-14 19:12:25 +02:00
Hector Fernandez
db323cd816 cosigned: Unify cue data and policy before evaluating it (#1793)
* chore: update cue policy evaluation

Signed-off-by: hectorj2f <hectorf@vmware.com>

* chore: change cue policy for the cip

Signed-off-by: hectorj2f <hectorf@vmware.com>

* chore: avoid using names with hyphens

Signed-off-by: hectorj2f <hectorf@vmware.com>

* test: add unit tests for the eval policy func

Signed-off-by: hectorj2f <hectorf@vmware.com>

* test: delete job before creating it

Signed-off-by: hectorj2f <hectorf@vmware.com>

* test: add statement to check the length of a struct

Signed-off-by: hectorj2f <hectorf@vmware.com>

* test: add more unit tests for eval policy

Signed-off-by: hectorj2f <hectorf@vmware.com>

* fix: wrong redirected file directory

Signed-off-by: hectorj2f <hectorf@vmware.com>
2022-04-26 16:26:06 +02:00
Ville Aikas
e1469ba182 Attestations + policy in cip. (#1772)
* Modify types, introduce name defaults, codegen.

Signed-off-by: Ville Aikas <vaikas@chainguard.dev>

* Start refactoring and adding verify-attestation pieces.

Signed-off-by: Ville Aikas <vaikas@chainguard.dev>

* Sort of works e2e.

Signed-off-by: Ville Aikas <vaikas@chainguard.dev>

* E2E tests. Plumb rekor through for key-ful signing too.

Signed-off-by: Ville Aikas <vaikas@chainguard.dev>

* bad rebase.

Signed-off-by: Ville Aikas <vaikas@chainguard.dev>

* more bad rebases.

Signed-off-by: Ville Aikas <vaikas@chainguard.dev>

* regen keys.
Signed-off-by: Ville Aikas <vaikas@chainguard.dev>

* at the right place.

Signed-off-by: Ville Aikas <vaikas@chainguard.dev>

* forgot one rekor-url.

Signed-off-by: Ville Aikas <vaikas@chainguard.dev>

* Lint.

Signed-off-by: Ville Aikas <vaikas@chainguard.dev>

* remove these manually.

Signed-off-by: Ville Aikas <vaikas@chainguard.dev>

* Cleanups, do not unnecessarily eval empty json bytes for attestation policy.

Signed-off-by: Ville Aikas <vaikas@chainguard.dev>

* Add name to attestations for easier referencing from cip policy.

Signed-off-by: Ville Aikas <vaikas@chainguard.dev>

* Do not return empty PolicyResult when errors.
Start adding UT for ValidatePolicy. Getting ready for rebase.

Signed-off-by: Ville Aikas <vaikas@chainguard.dev>

* fix: cue policy missing double-quotes

Signed-off-by: hectorj2f <hectorf@vmware.com>

* Add start of unit tests for policy validation stuff.
Add start of UT for ValidatePolicy.

Signed-off-by: Ville Aikas <vaikas@chainguard.dev>

* Refactor policy eval code. Remove the attestation CIP from normal
CIP tests, will follow up with those.
Add validation for attestations in CIPs

Signed-off-by: Ville Aikas <vaikas@chainguard.dev>

* loving yaml, thanks validation!

Signed-off-by: Ville Aikas <vaikas@chainguard.dev>

* Starting to break apart the attestation tests.

Signed-off-by: Ville Aikas <vaikas@chainguard.dev>

* checkpoint

Signed-off-by: Ville Aikas <vaikas@chainguard.dev>

* Remove unused keychain from the Validate* calls and use one
from the remoteopts instead consistently.
Address PR feedback.

Signed-off-by: Ville Aikas <vaikas@chainguard.dev>

* lint.

Signed-off-by: Ville Aikas <vaikas@chainguard.dev>

Co-authored-by: hectorj2f <hectorf@vmware.com>
2022-04-23 06:47:40 -07:00
Ville Aikas
9516998877 Validate issuer/subject regexp in validate webhook. (#1761)
Signed-off-by: Ville Aikas <vaikas@chainguard.dev>
2022-04-14 14:29:05 -05:00
Ville Aikas
0c232dac0f Implement identities, fix bug in webhook validation. (#1759)
* Implement identites, fix bug in webhook validation.

Signed-off-by: Ville Aikas <vaikas@chainguard.dev>

* fix lint.

Signed-off-by: Ville Aikas <vaikas@chainguard.dev>

* Fix the invalid test that was incorrectly assuming identities can't be specified.
Fix the actions yaml file typo. missing actual run, doh.

Signed-off-by: Ville Aikas <vaikas@chainguard.dev>
2022-04-14 11:12:17 -07:00
Ville Aikas
cf03ef22b2 Refactor policy related code, add support for vuln verify (#1747)
* Refactor policy related code, add support for vuln verify

Signed-off-by: Ville Aikas <vaikas@chainguard.dev>

* Thanks @hectorj2f for catching a bad upstream rebase.

Signed-off-by: Ville Aikas <vaikas@chainguard.dev>

* Fix typo.

Signed-off-by: Ville Aikas <vaikas@chainguard.dev>
2022-04-12 16:06:12 -07:00
Denny
d03404e0ca Fix publicKey unmarshal (#1719)
- Add key sign verify for cosigned github workflow

Signed-off-by: Denny Hoang <dhoang@vmware.com>
2022-04-07 12:30:33 -07:00
Ville Aikas
9496416da1 Add e2e test for attest / verify-attestation (#1685)
* Remove the non-functioning sanity check, add e2e test for validating
a cue policy both with success and failure.

Signed-off-by: Ville Aikas <vaikas@chainguard.dev>

* oops, forgot to use test env variables instead of local tests :)

Signed-off-by: Ville Aikas <vaikas@chainguard.dev>
2022-03-30 11:25:40 -05:00
priyawadhwa
017c438e97 Find all valid entries in verify-blob (#1673)
* Find all valid entries in verify-blob

At the moment we only check the most recent entry, and fail if verification fails.
Instead, we should look at all matching entries to see if any of them verify.

Signed-off-by: Priya Wadhwa <priya@chainguard.dev>

* Code review comments

Signed-off-by: Priya Wadhwa <priya@chainguard.dev>
2022-03-28 18:49:30 -05:00
Ville Aikas
4fb895012d First batch of followups to #1650 (#1664)
* First batch of followups to #1650

Signed-off-by: Ville Aikas <vaikas@chainguard.dev>

* Fix few typos.

Signed-off-by: Ville Aikas <vaikas@chainguard.dev>

* remove some unnecessary cruft since the actions handle them.

Signed-off-by: Ville Aikas <vaikas@chainguard.dev>

* kubectl apply vs. create
Signed-off-by: Ville Aikas <vaikas@chainguard.dev>

* try harder
Signed-off-by: Ville Aikas <vaikas@chainguard.dev>

* registry before installations.

Signed-off-by: Ville Aikas <vaikas@chainguard.dev>

* Remove trying with 1.23 which might have different job retry behaviour.

Signed-off-by: Ville Aikas <vaikas@chainguard.dev>
2022-03-25 14:33:44 -07:00
Ville Aikas
340b6c6d9a Use ClusterImagePolicy with Keyless + e2e tests for CIP with kind (#1650)
* Just setting up the cluster tests.

Signed-off-by: Ville Aikas <vaikas@chainguard.dev>

* Sign/verify a simple container.

Signed-off-by: Ville Aikas <vaikas@chainguard.dev>

* Plumb Keyless with Fulcio / Rekor through.

Signed-off-by: Ville Aikas <vaikas@chainguard.dev>

* Start wiring tests together. Not complete.

Signed-off-by: Ville Aikas <vaikas@chainguard.dev>

* Ok, now the test should work, last run should've failed, it did. woot!

Signed-off-by: Ville Aikas <vaikas@chainguard.dev>

* Return policies instead of all the authorities in one fell swoop since
we need to make sure that all policies have at least one validating
authority.

Signed-off-by: Ville Aikas <vaikas@chainguard.dev>

* Cleanup, add keyless unit tests. For now just failure cases, need to
understand how to test fully with both rekor/fulcio the good case.

Signed-off-by: Ville Aikas <vaikas@chainguard.dev>

* Removed the API path portion of the test CIP as no longer necessary.

Signed-off-by: Ville Aikas <vaikas@chainguard.dev>
2022-03-24 17:24:29 -07:00
Adam A.G. Shamblin
45dbd39514 Validate authority keys (#1623)
* Validate signature with authority keys

Signed-off-by: Denny Hoang <dhoang@vmware.com>

* Remove TODO log

Signed-off-by: Denny Hoang <dhoang@vmware.com>

* Add authority key info log & ko-apply to makefile

Signed-off-by: Denny Hoang <dhoang@vmware.com>

* Abstract and test getting authority keys

Signed-off-by: Denny Hoang <dhoang@vmware.com>

* Add authority regex matching for images

Signed-off-by: Denny Hoang <dhoang@vmware.com>

* Add more get authority key scenarios

Signed-off-by: Denny Hoang <dhoang@vmware.com>

* Rename and use variables

Signed-off-by: Denny Hoang <dhoang@vmware.com>

* Validate and compile regex

Signed-off-by: Denny Hoang <dhoang@vmware.com>

* Add regex cosigned testdata

Signed-off-by: Denny Hoang <dhoang@vmware.com>

* Fix lint error

Signed-off-by: Denny Hoang <dhoang@vmware.com>

* Test authority key integration

Signed-off-by: Denny Hoang <dhoang@vmware.com>

* Surface non-enforced errors

Signed-off-by: Denny Hoang <dhoang@vmware.com>

* Fix linting errors

Signed-off-by: Denny Hoang <dhoang@vmware.com>

* Fix e2e crd test to remove crd between tests

Signed-off-by: Denny Hoang <dhoang@vmware.com>

Co-authored-by: Denny Hoang <dhoang@vmware.com>
2022-03-22 10:09:41 +01:00
Ville Aikas
f8a6bad917 Fix 1608, 1613 (#1617)
Signed-off-by: Ville Aikas <vaikas@chainguard.dev>
2022-03-16 09:22:39 -05:00
Kavitha
d22c312573 Add public key validation (#1598)
* Add public key validation

Signed-off-by: Kavitha Krishnan <krishnanka@vmware.com>

* fix: key validation

Signed-off-by: hectorj2f <hectorf@vmware.com>

* fix: test valid policy using wrong key data

Signed-off-by: hectorj2f <hectorf@vmware.com>

Co-authored-by: hectorj2f <hectorf@vmware.com>
2022-03-13 08:39:37 -05:00
Ville Aikas
0d7bace058 Fix #1592 move authorities as siblings of images. (#1593)
Signed-off-by: Ville Aikas <vaikas@chainguard.dev>
2022-03-11 05:26:53 -05:00
Ville Aikas
bf799ed71c Fix #1583 #1582. Disallow regex now until implemented. (#1584)
Signed-off-by: Ville Aikas <vaikas@chainguard.dev>
2022-03-10 09:16:05 -06:00
Kavitha
c341168afa 1417 policy validations (#1548)
* Register webhook and add configuration

Signed-off-by: Kavitha Krishnan <krishnanka@vmware.com>

* Add validation tests for policy crd

Signed-off-by: Kavitha Krishnan <krishnanka@vmware.com>
Signed-off-by: Adam Shamblin <ashamblin@vmware.com>
Signed-off-by: Kavitha Krishnan <krishnanka@vmware.com>

* Update clusterrole;Add ko local for webhook

Signed-off-by: Adam Shamblin <ashamblin@vmware.com>
Signed-off-by: Kavitha Krishnan <krishnanka@vmware.com>

* Add e2e tests for policy creation

Signed-off-by: Kavitha Krishnan <krishnanka@vmware.com>
Signed-off-by: Adam Shamblin <ashamblin@vmware.com>

* Move testdata to a separate folder; Remove current timestamp proeprty

Signed-off-by: Kavitha Krishnan <krishnanka@vmware.com>

* Move crd tests to a different step

Signed-off-by: Adam Shamblin <ashamblin@vmware.com>
Signed-off-by: Kavitha Krishnan <krishnanka@vmware.com>

* Refactor policy crd test script

Signed-off-by: Adam Shamblin <ashamblin@vmware.com>
Signed-off-by: Kavitha Krishnan <krishnanka@vmware.com>

* Separate policy webhooks from cosigned webhooks

Signed-off-by: Adam Shamblin <ashamblin@vmware.com>

* Fix lint

Signed-off-by: Kavitha Krishnan <krishnanka@vmware.com>

* Remove unused var

Signed-off-by: Adam Shamblin <ashamblin@vmware.com>

* Add policy webhook secrets

Signed-off-by: Kavitha Krishnan <krishnanka@vmware.com>

Co-authored-by: Adam Shamblin <ashamblin@vmware.com>
2022-03-09 22:41:19 -08:00
Michael Lieberman
cb310df630 Fix verify-dockerfile to allow lowercase FROM (#643)
This is a simple fix to allow "from" in dockerfiles to have their
image arguments detected by verify-dockerfile command.

Signed-off-by: Michael <mlieberman85@gmail.com>
2021-09-10 09:51:21 -05:00
Joshua Hansen
0fdfaa9344 Add cosign verify-manifest command (#490)
* Add `cosign verify-manifest` command

Signed-off-by: Joshua Hansen <j4ah4n@gmail.com>

* add allowed extension check

Signed-off-by: Batuhan Apaydın <batuhan.apaydin@trendyol.com>

* Remove Dockerfile refs from help

Signed-off-by: Joshua Hansen <josh.hansen@handsome.is>

* Fix lint, doc checks

Signed-off-by: Joshua Hansen <josh.hansen@handsome.is>

Co-authored-by: Batuhan Apaydın <batuhan.apaydin@trendyol.com>
2021-07-29 09:56:05 -05:00
Jake Sanders
e63d8adec9 add cosign verify-dockerfile command (#395)
Signed-off-by: Jake Sanders <jsand@google.com>
2021-06-29 14:45:27 -07:00
dlorenc
17ad4d0eab Refactor the SBOM/blob/wasm handling and add some tests. (#394)
Signed-off-by: Dan Lorenc <dlorenc@google.com>
2021-06-28 11:32:29 -05:00