Skip to content

Commit 471d83a

Browse files
Skip unrecognized keys
This library does not support Rekor v2, which has caused issues when a new key type is attempted. Until we have comprehensive support for Rekor v2, we can skip unrecognized keys. Signed-off-by: Landon Grindheim <landon.grindheim@gmail.com>
1 parent 67ec113 commit 471d83a

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

lib/sigstore/internal/key.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ def self.from_key_details(key_details, key_bytes)
3030
key_type = "rsa"
3131
key_schema = "rsa-pkcs1v15-sha256"
3232
else
33-
raise Error::UnsupportedKeyType, "Unsupported key type #{key_details}"
33+
# Skip unrecognized key types instead of raising an error.
34+
# This allows the library to work with newer trusted roots that include
35+
# key types we don't yet support (e.g., PKIX_ED25519 for Rekor v2).
36+
logger.warn { "Skipping unrecognized key type: #{key_details}" }
37+
return nil
3438
end
3539

3640
read(key_type, key_schema, key_bytes, key_id: OpenSSL::Digest::SHA256.hexdigest(key_bytes))

lib/sigstore/trusted_root.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ def tlog_keys(tlogs)
8787

8888
tlogs.each do |transparency_log_instance|
8989
key = transparency_log_instance.public_key
90-
yield Internal::Key.from_key_details(key.key_details, key.raw_bytes)
90+
parsed_key = Internal::Key.from_key_details(key.key_details, key.raw_bytes)
91+
yield parsed_key if parsed_key
9192
end
9293
end
9394

0 commit comments

Comments
 (0)