Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support non-Sigstore TSAs #2704

Closed
haydentherapper opened this issue Feb 9, 2023 · 2 comments · Fixed by #2708
Closed

Support non-Sigstore TSAs #2704

haydentherapper opened this issue Feb 9, 2023 · 2 comments · Fixed by #2708
Labels
enhancement New feature or request

Comments

@haydentherapper
Copy link
Contributor

haydentherapper commented Feb 9, 2023

The sigstore TSA implements an API to fetch timestamps, as does any other public TSA. Every API uses different paths to request timestamps, but all should conform to the same API structure, accepting timestamp queries and returning timestamp responses. We should support providing a path (timestamp-url) not to the sigstore TSA instance, but instead to the complete path to fetch a TSR (e.g. <sigstoretsapath.com>/api/v1/timestamp, or https://freetsa.org/tsr, or http://timestamp.digicert.com)

This means using a different TSA client than the sigstore TSA client, which is only useful for fetching timestamps from a service that has the same API paths as the sigstore TSA.

Ignore everything below, left as an unnecessary alternative

For users that want to leverage a TSA that uses a different API than the sigstore TSA, we should support attaching a signed timestamp after artifact signing.

For container signing, UX would look something like:

  1. User signs container with Cosign
  2. User fetches signature from OCI annotation
  3. User crafts a timestamp query, for example using openssl (where --data should be the signature)
  4. User requests a timestamp from their trusted TSA, for example FreeTSA
  5. User attaches the signed timestamp to OCI

Verification with a signed timestamp should then work without any modification, but this should be confirmed.

For blob signing, during verification, simply pass the signed timestamp you fetched from a trusted TSA after signing with --rfc3161-timestamp. The one caveat is it must be crafted as a [struct]

type RFC3161Timestamp struct {
// SignedRFC3161Timestamp contains a DER encoded TimeStampResponse.
// See https://www.rfc-editor.org/rfc/rfc3161.html#section-2.4.2
// Clients MUST verify the hashed message in the message imprint,
// typically using the artifact signature.
SignedRFC3161Timestamp []byte
}
). I propose we be more lax in accepting a raw or base64 encoded TSR in addition to the struct (I don't think we should add a command to convert a TSR into this struct)

@haydentherapper haydentherapper added the enhancement New feature or request label Feb 9, 2023
@asraa
Copy link
Contributor

asraa commented Feb 9, 2023

RFC 3161 TSA's have a required API - shouldn't cosign be using that? That way it'd be compatible with all RFC 3161 TSA's.

I think there were some specifics of the sigstore's TSA API, but maybe cosign should implement a TSA client from the base API in the spec?

@haydentherapper
Copy link
Contributor Author

Yea, you're right, there isn't a specification for standardizing the API path, but there is for what the TSA should accept (a timestamp query). I agree, we can add a TSA client that fetches a TSR based on a TSQ and a provided path (FreeTSA uses https://freetsa.org/tsr, I think Digicert is just http://timestamp.digicert.com). Right now the client is for sigstore's TSA API only, a wrapper around the openapi definition.

@haydentherapper haydentherapper changed the title Support attaching a signed timestamp after artifact signing Support non-Sigstore TSAs Feb 9, 2023
haydentherapper added a commit to haydentherapper/cosign that referenced this issue Feb 10, 2023
This changes the client to instead simply exchange a TSQ for a TSR given
a URL to the API. This will mean that for clients using timestamping
currently, they will need to update their Cosign calls to use the full
path (e.g. tsa.sigstore/api/v1/timestamp)

Fixes sigstore#2704

Signed-off-by: Hayden Blauzvern <[email protected]>
priyawadhwa pushed a commit that referenced this issue Feb 16, 2023
* Support non-Sigstore TSA requests

This changes the client to instead simply exchange a TSQ for a TSR given
a URL to the API. This will mean that for clients using timestamping
currently, they will need to update their Cosign calls to use the full
path (e.g. tsa.sigstore/api/v1/timestamp)

Fixes #2704

Signed-off-by: Hayden Blauzvern <[email protected]>

* Address comments

Signed-off-by: Hayden Blauzvern <[email protected]>

---------

Signed-off-by: Hayden Blauzvern <[email protected]>
dmitris pushed a commit to dmitris/cosign that referenced this issue Mar 24, 2023
* Support non-Sigstore TSA requests

This changes the client to instead simply exchange a TSQ for a TSR given
a URL to the API. This will mean that for clients using timestamping
currently, they will need to update their Cosign calls to use the full
path (e.g. tsa.sigstore/api/v1/timestamp)

Fixes sigstore#2704

Signed-off-by: Hayden Blauzvern <[email protected]>

* Address comments

Signed-off-by: Hayden Blauzvern <[email protected]>

---------

Signed-off-by: Hayden Blauzvern <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants