Open woodruffw opened 11 months ago
Partial dupe of #779, closing that one in favor of this.
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:
--trusted-root <FILE>
so TUF can be skipped without making a mess of the UIAll of these can happen in separate issues/PRs
- 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 🙂
Some notes after a bit of thinking:
--trusted-root
- 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!
I'll take this. Plan is:
def from_file(path: str) -> MyTrustedRoot:
def from_tuf(url: str, offline: bool = False) -> MyTrustedRoot:
def production(offline: bool = False) -> MyTrustedRoot: # helper, calls from_tuf()
def staging(offline: bool = False) -> MyTrustedRoot: # helper, calls from_tuf()
from_tuf()
(and the helpers production()
and staging()
) will use TrustUpdater by default but from_file()
(and the others if offline) will just get trust root from a file--trusted-root
should be fairly trivial but I'll probably leave the offline UX support for a later PR if that looks complicated 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
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
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.
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 🙂
I think we agree on everything here.
See https://github.com/sigstore/sigstore-conformance/pull/101.