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

Remove re-implementation of sigstore proto types #94

Conversation

segiddins
Copy link
Member

@segiddins segiddins commented Aug 23, 2024

Targets #81

Signed-off-by: Samuel Giddins [email protected]

lib/sigstore/internal/x509.rb Show resolved Hide resolved
lib/sigstore/models.rb Show resolved Hide resolved
lib/sigstore/rekor/client.rb Show resolved Hide resolved
lib/sigstore/signer.rb Show resolved Hide resolved
lib/sigstore/signer.rb Show resolved Hide resolved
end

general_names = leaf.extension(Internal::X509::Extension::SubjectAlternativeName).general_names
expected_san = [[:uniformResourceIdentifier, @identity_token.identity]]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this generally going to be true, even for other issuers?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, unfortunately -- the Google and GitHub (user, not actions) issuers will embed a SAN with an rfc822Name instead, corresponding to the underlying email subject.

IIRC the way we handle this on sigstore-python is to enforce that there's exactly one SAN and check the SAN's value, regardless of its specified type. This isn't ideal from a domain separation perspective but it's about as clean as it currently gets without a stronger notion of subject "type" on the OIDC side.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm -- given the spec calls for the client to validate the returned SAN, it would be helpful if we could publish a simple mapping of ID providers to subject names somewhere in fulcio that clients can grab and substitute into?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this would be good to have -- I think the closest thing to this currently is https://github.com/sigstore/fulcio/blob/b2186c01da1ddf807bde3ea8c450226d8e001d88/pkg/config/config.go#L182-L201, but that's only in Fulcio's code and not documented anywhere separately AFAICT.

(IMO we could make this general in a follow-up, or weaken the check to not include the SAN type and only match on the SAN value. Your call!)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

end

body = JSON.parse(resp.body)

# TODO: verify
# The signer MUST verify the log entry as in Spec: Transparency Service.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

given this happens immediately below in verify, is verifying the log entry separately necessary?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My interpretation of the spec is "no," although sigstore-python doesn't actually do "verify after sign" yet 😅. CC @loosebazooka @steiza for other client opinions.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(maybe i'm reading this ruby code wrong but) Java does a verification here https://github.com/sigstore/sigstore-java/blob/main/sigstore-java/src/main/java/dev/sigstore/KeylessSigner.java#L338 immediately after obtaining the log entry. There's some presumed minor benefit that if the log goes rogue, you get to detect it a little early?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sigstore-go does not verify the transparency log entry it receives during signing, but it will verify the bundle before returning it to the user, if a trusted root to verify with is provided.

lib/sigstore/verifier.rb Outdated Show resolved Hide resolved
@@ -396,5 +392,91 @@ def extract_timestamp_from_verification_data(data)
resp.token_info.gen_time
end
end

def find_rekor_entry(bundle, hashed_input, offline:)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved from the model into the verifier

@segiddins segiddins changed the title Begin removing wrappers around sigstore proto types Remove re-implementation of sigstore proto types Aug 24, 2024
Signed-off-by: Samuel Giddins <[email protected]>
Copy link
Member

@woodruffw woodruffw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM overall, left two comments on two discussion points. IMO this is in a decent enough shape as-is to merge and iterate on, although making the SAN match more general is probably a hard requirement for a stable release.

Signed-off-by: Samuel Giddins <[email protected]>
@segiddins segiddins merged commit 3f017dd into segiddins/sigstore-signer Sep 17, 2024
26 of 33 checks passed
@segiddins segiddins deleted the segiddins/begin-removing-wrappers-around-sigstore-proto-types branch September 17, 2024 11:22
segiddins added a commit that referenced this pull request Sep 17, 2024
* Begin removing wrappers around sigstore proto types

Signed-off-by: Samuel Giddins <[email protected]>

* Remove verification materials

Signed-off-by: Samuel Giddins <[email protected]>

* Implement more signing verification

Signed-off-by: Samuel Giddins <[email protected]>

* Address 2 comments

Signed-off-by: Samuel Giddins <[email protected]>

* Relax SAN check

Signed-off-by: Samuel Giddins <[email protected]>

---------

Signed-off-by: Samuel Giddins <[email protected]>
segiddins added a commit that referenced this pull request Sep 24, 2024
* Begin removing wrappers around sigstore proto types

Signed-off-by: Samuel Giddins <[email protected]>

* Remove verification materials

Signed-off-by: Samuel Giddins <[email protected]>

* Implement more signing verification

Signed-off-by: Samuel Giddins <[email protected]>

* Address 2 comments

Signed-off-by: Samuel Giddins <[email protected]>

* Relax SAN check

Signed-off-by: Samuel Giddins <[email protected]>

---------

Signed-off-by: Samuel Giddins <[email protected]>
segiddins added a commit that referenced this pull request Sep 24, 2024
* Sigstore signer

Signed-off-by: Samuel Giddins <[email protected]>

Revert "Add merkle inclusion proof tests"

This reverts commit 7a4bef7f6f1f0f7a8bb76e9c9a214d6de5900fa7.

* [DNM] Dump base64 of failed req for debugging

Signed-off-by: Samuel Giddins <[email protected]>

* Remove re-implementation of sigstore proto types (#94)

* Begin removing wrappers around sigstore proto types

Signed-off-by: Samuel Giddins <[email protected]>

* Remove verification materials

Signed-off-by: Samuel Giddins <[email protected]>

* Implement more signing verification

Signed-off-by: Samuel Giddins <[email protected]>

* Address 2 comments

Signed-off-by: Samuel Giddins <[email protected]>

* Relax SAN check

Signed-off-by: Samuel Giddins <[email protected]>

---------

Signed-off-by: Samuel Giddins <[email protected]>

* Use Internal::Key for sigstore keyrings too

Signed-off-by: Samuel Giddins <[email protected]>

* Address comments on signing pr

Signed-off-by: Samuel Giddins <[email protected]>

* Stop hanging keyrings off the rekor client

Signed-off-by: Samuel Giddins <[email protected]>

* Actually use proper tmpdir for home

Signed-off-by: Samuel Giddins <[email protected]>

---------

Signed-off-by: Samuel Giddins <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants