cosign: auto-detect verify policy from custom Sigstore trusted roots - #2062
Open
stealthybox wants to merge 6 commits into
Open
cosign: auto-detect verify policy from custom Sigstore trusted roots#2062stealthybox wants to merge 6 commits into
stealthybox wants to merge 6 commits into
Conversation
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.
OCIRepositoryrecently added a custom Sigstoretrusted_root.jsonvia.spec.verify.trustedRootSecretRef. This patch makes thecosign verifier derive its verification policy from the contents of that
trusted root instead of hard-coding it.
This allows the components used in private/custom/3rd-party sigstore stacks to use
the infrastructure components they opt into.
It also adds a self-contained end-to-end test harness that stands up a real
Sigstore stack + TSA on a separate e2e kind cluster + unit tests
for the new policy auto detection.
Behavior
Verification policy is auto-detected from the trusted root:
baseUrlvalues are tried deterministically for legacy online lookupKeyless verification with a custom root requires Fulcio plus at least one durable
time source (Rekor or TSA), preventing acceptance of a keyless signature that has only an
identity certificate with no transparency-log inclusion or trusted timestamp.
(this is an invalid/insecure configuration that we should discourage)
Keyed verification combined with a custom trusted root no longer forces
Offline=true/IgnoreTlog=true; tlog or TSA material in the bundle is verifiedalongside the public key. Keyed verification without a custom trusted root keeps
the legacy offline behavior.
Any Fulcio or CTLog that is present in a custom root are ignored during keyed verification.
Design Considerations
This automatic verification policy behavior allows us to support new combinations of
sigstore components without adding new fields to the API.
It is notable that this drifts from the Sigstore spec recommendation. The spec mentions the
trust material/bundle contents should not be considered a verification policy.
The current Flux verification policy is effectively hard-coded to two sets of differing defaults
for keyed and keyless flows. This makes it challenging to evolve the API in a way that behaves
somewhat uniformly when users start passing custom trust material, or in the future if we want
to add an alternative path for per-resource TUF roots. It also complicates the behavior for
controller-level overrides.
Since we cannot break existing behaviors on our GA API's, we basically two implementation options:
then add options in follow-ups for people to opt-in to explicit, more secure,
sigstore-spec compliant, per-resource/controller-level verification policy
have specific hard-coded defaults, but also expose additional fields for whether to require
or ignore each of the 4 categories of trust material.
( some combinations are insecure or should be considered invalid )
This PR does not modify the existing default verification policy for
cosign SDK usage of TUF or sigstore trusted roots via files on the controller filesystem.
(via
TUF_ROOT_JSON/SIGSTORE_ROOT_FILE)For those, additional controller level flags to granularly modify the defaults will be
necessary. The behavior prior to and with this PR is to ignore TSA and require Rekor/Fulcio/CTLog
which is a verification policy that is designed for the public-good instance.
Testing
CheckOptsmutation, Rekor URLextraction (sort/dedupe), and the online Rekor retry loop.
hack/sigstore-test/harness installs the sigstore scaffold stack(Trillian, Rekor, Fulcio, CT log) plus an RFC3161 TSA on kind and runs a
cosign v2/v3 * key-pair/keyless verification matrix against a live
source-controller, including negative cases that must report
Ready=False/VerificationError.sigstoree2e job alongside the existing e2e job.The first commit with test cases cover e2e for the already merged custom root field.
The next commits with the failing tests are intended for the auto-detect behavior.
Then the subsequent commit adds the auto-detect functionality to show that it makes the
tests pass.
Docs
I added to
docs/spec/v1/ocirepositories.mdfor the auto-detection policy tableand multi-instance trusted-root guidance