sigstore / sigstore-python

A Sigstore client written in Python
https://pypi.org/p/sigstore
Other
227 stars 49 forks source link

Conformance: sigstore-python's conformance runner should support `--trusted-root` #821

Open woodruffw opened 11 months ago

woodruffw commented 11 months ago

See https://github.com/sigstore/sigstore-conformance/pull/101.

woodruffw commented 11 months ago

Partial dupe of #779, closing that one in favor of this.

jku commented 11 months ago

From #779:

This will unify the current rats nest of flags for configuring custom Sigstore behavior: we'll be able to deprecate and eventually remove --rekor-url, --rekor-root-pubkey, --fulcio-url, --ctfe, and possibly some others. This in turn will allow us to close https://github.com/sigstore/sigstore-python/issues/324.

This sounds good:

All of these can happen in separate issues/PRs

woodruffw commented 11 months ago
  • deprecate flags mentioned above to make it clear a complete trusted root should be provided instead (there might be some exceptions to this but I think that's a good general rule)

Yeah, I think we can get all of them with this -- we could deprecate with 2.1.x and plan to fully remove with 3.x, which would make me very happy 🙂

jku commented 11 months ago

Some notes after a bit of thinking:

woodruffw commented 11 months ago
  • We should separate them as the TUF operations are only needed in the default case above but the latter is needed in all three cases

Makes sense to me!

jku commented 11 months ago

I'll take this. Plan is:

jku commented 11 months ago

Okay I have the internal refactor done... but I'm not sure how to correctly add the --trusted-root flag:

@woodruffw I'm guessing you'll have a hunch on this

jku commented 10 months ago

I should choose the rekor_url value based on data from trusted root: can I assume all values in tlogs array in the trusted root have the same baseURL? Maybe RekorClient should handle url per key?

I think I'll look into modifying the Keyring abstraction so that it keeps track of url-key pairs instead of just keys. Alternative ideas are welcome.

Alternatively I might stop here and make a refactor PR out of my current changes... So then we can do a spearate refactoring for keyring/rekorClient and then add the UI option

woodruffw commented 10 months ago

Maybe RekorClient should handle url per key?

This sounds right to me -- my read of the TrustedRoot definition is that the base URLs are not guaranteed to be equivalent between different log instances (and maybe even can't be, since the point is to have multiple distinct logs?)

same url question for CAs...

Yeah, this is confusing/ambiguous: my intuition there is that the TrustedRoot needs some way to signal the "CSR" CA, i.e. the one that's actually talked to for signing purposes. But that doesn't seem to exist yet, so maybe the right logic here (for now) is to fail unless there's exactly one CA listed and that CA has a URI?

Edit: Another maybe reasonable decision procedure here is to search through the listed CAs, and use the first that lists a URI? That one is presumably a sufficient one to submit CSRs to.

oauth issuer url is not documented in the trusted_root -- maybe it should be

This would be the Dex instance URL, right? If so, yes, agreed.

woodruffw commented 10 months ago

I think I'll look into modifying the Keyring abstraction so that it keeps track of url-key pairs instead of just keys. Alternative ideas are welcome.

Alternatively I might stop here and make a refactor PR out of my current changes... So then we can do a spearate refactoring for keyring/rekorClient and then add the UI option

That keyring refactor SGTM, but 👍 on creating an initial refactor PR first -- smaller changesets will be easier to test 🙂

jku commented 10 months ago

I think we agree on everything here.