chains icon indicating copy to clipboard operation
chains copied to clipboard

Verify the SCT coming back from Fulcio.

Open vaikas opened this issue 3 years ago • 7 comments

Feature request

I think we should verify the SCT coming back from Fulcio to ensure we're not being bamboozled by it. So here: https://github.com/tektoncd/chains/blob/main/pkg/chains/signing/x509/x509.go#L83

We call the fulcio.NewSigner, but I think we should consider calling the fulcioverifier version of it here: https://github.com/sigstore/cosign/blob/main/cmd/cosign/cli/fulcio/fulcioverifier/fulcioverifier.go#L96

Which then in turn additionally verifies the SCT coming back here: https://github.com/sigstore/cosign/blob/main/cmd/cosign/cli/fulcio/fulcioverifier/fulcioverifier.go#L103

My understanding is that it's not quite as simple as just importing this version due to some conflicting log imports from here: https://github.com/sigstore/cosign/blob/main/cmd/cosign/cli/fulcio/fulcioverifier/fulcioverifier.go#L29

But, maybe it's just as simple as just swapping? :) Haven't had a chance to verify it yet, just jotting this down.

Use case

It's important to verify that Fulcio actually added the Certificate to a CTLog and SCT is that proof, so it should be verified. Currently we don't (or I totes missed where we dot it).

vaikas avatar Jan 10 '22 21:01 vaikas

Thanks for catching this, we definitely should be verifying the SCT!

Unfortunately it looks like just swapping might not work, seems like the dependency you pointed out ("github.com/google/certificate-transparency-go/x509") depends on glog which Chains can't depend on because of the "log_dir redefined flag error" 😞

We could either try to remove the glog dependency from the certificate-transparency-go lib upstream, or try to rewrite the SCT verification in Chains. First option is probably better!

priyawadhwa avatar Jan 10 '22 22:01 priyawadhwa

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale with a justification. Stale issues rot after an additional 30d of inactivity and eventually close. If this issue is safe to close now please do so with /close with a justification. If this issue should be exempted, mark the issue as frozen with /lifecycle frozen with a justification.

/lifecycle stale

Send feedback to tektoncd/plumbing.

tekton-robot avatar Apr 10 '22 23:04 tekton-robot

/remove-lifecycle stale

priyawadhwa avatar Apr 11 '22 05:04 priyawadhwa

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale with a justification. Stale issues rot after an additional 30d of inactivity and eventually close. If this issue is safe to close now please do so with /close with a justification. If this issue should be exempted, mark the issue as frozen with /lifecycle frozen with a justification.

/lifecycle stale

Send feedback to tektoncd/plumbing.

tekton-robot avatar Jul 10 '22 05:07 tekton-robot

/remove-lifecycle stale

priyawadhwa avatar Jul 11 '22 10:07 priyawadhwa

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale with a justification. Stale issues rot after an additional 30d of inactivity and eventually close. If this issue is safe to close now please do so with /close with a justification. If this issue should be exempted, mark the issue as frozen with /lifecycle frozen with a justification.

/lifecycle stale

Send feedback to tektoncd/plumbing.

tekton-robot avatar Oct 09 '22 11:10 tekton-robot

/remove-lifecycle stale

priyawadhwa avatar Oct 11 '22 06:10 priyawadhwa

We do SCT verification in Cosign, and worked around the glog issue by copying in ctutil - https://github.com/sigstore/cosign/blob/7ba521444f9fcfdf2e1e5936c05834597674e6c9/cmd/cosign/cli/fulcio/fulcioverifier/ctutil/ctutil.go

See https://github.com/sigstore/cosign/blob/30bf1c09c6fde849245648ff294725d86094fe28/cmd/cosign/cli/fulcio/fulcioverifier/ctl/verify.go for the verification. It still pulls from certificate-transparency-go, but avoids pulling in anything with glog.

haydentherapper avatar Oct 20 '22 21:10 haydentherapper

We mirrored the policy-controller replace in https://github.com/tektoncd/chains/pull/514 so I don't think glog is a blocker anymore.

@haydentherapper Should we just upstream the SCT check to the Fulcio library? sigstore-go also works, but this feels fundamental enough that it might make sense in fulcio proper. 🤔

wlynch avatar Oct 20 '22 23:10 wlynch

Yea, I'd be fine with adding that into a fulcio package!

haydentherapper avatar Oct 24 '22 22:10 haydentherapper

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale with a justification. Stale issues rot after an additional 30d of inactivity and eventually close. If this issue is safe to close now please do so with /close with a justification. If this issue should be exempted, mark the issue as frozen with /lifecycle frozen with a justification.

/lifecycle stale

Send feedback to tektoncd/plumbing.

tekton-robot avatar Jan 22 '23 23:01 tekton-robot

/remove-lifecycle stale

priyawadhwa avatar Jan 24 '23 16:01 priyawadhwa

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale with a justification. Stale issues rot after an additional 30d of inactivity and eventually close. If this issue is safe to close now please do so with /close with a justification. If this issue should be exempted, mark the issue as frozen with /lifecycle frozen with a justification.

/lifecycle stale

Send feedback to tektoncd/plumbing.

tekton-robot avatar Apr 24 '23 17:04 tekton-robot

Stale issues rot after 30d of inactivity. Mark the issue as fresh with /remove-lifecycle rotten with a justification. Rotten issues close after an additional 30d of inactivity. If this issue is safe to close now please do so with /close with a justification. If this issue should be exempted, mark the issue as frozen with /lifecycle frozen with a justification.

/lifecycle rotten

Send feedback to tektoncd/plumbing.

tekton-robot avatar May 24 '23 17:05 tekton-robot

Rotten issues close after 30d of inactivity. Reopen the issue with /reopen with a justification. Mark the issue as fresh with /remove-lifecycle rotten with a justification. If this issue should be exempted, mark the issue as frozen with /lifecycle frozen with a justification.

/close

Send feedback to tektoncd/plumbing.

tekton-robot avatar Jun 23 '23 18:06 tekton-robot

@tekton-robot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity. Reopen the issue with /reopen with a justification. Mark the issue as fresh with /remove-lifecycle rotten with a justification. If this issue should be exempted, mark the issue as frozen with /lifecycle frozen with a justification.

/close

Send feedback to tektoncd/plumbing.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

tekton-robot avatar Jun 23 '23 18:06 tekton-robot