Skip to content

Commit

Permalink
Support cpython bundles & fix dsse 0.0.1 entries (#125)
Browse files Browse the repository at this point in the history
  • Loading branch information
segiddins authored Oct 1, 2024
1 parent bed56a6 commit e9341d7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions lib/sigstore/internal/x509.rb
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,8 @@ def parse_value(value)
tag = general_name.tag

case tag
when 1
[:otherName, general_name.value]
when 6
[:uniformResourceIdentifier, general_name.value]
else
Expand Down
2 changes: 1 addition & 1 deletion lib/sigstore/models.rb
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ def expected_dsse_0_0_1_tlog_entry
dsse_envelope.signatures.map do |sig|
{
"signature" => Internal::Util.base64_encode(sig.sig),
"verifier" => Internal::Util.base64_encode(certificate.to_pem)
"verifier" => Internal::Util.base64_encode(leaf_certificate.to_pem)
}
end
}
Expand Down
2 changes: 1 addition & 1 deletion lib/sigstore/policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def verify(cert)
san_ext = cert.extension(Sigstore::Internal::X509::Extension::SubjectAlternativeName)
raise Error::InvalidCertificate, "Certificate does not contain subjectAltName extension" unless san_ext

verified = san_ext.general_names.include?([:uniformResourceIdentifier, @identity])
verified = san_ext.general_names.any? { |_, id| id == @identity }
unless verified
return VerificationFailure.new(
"Certificate's SANs do not match #{@identity}; actual SANs: #{san_ext.general_names}"
Expand Down

0 comments on commit e9341d7

Please sign in to comment.