Skip to content

Commit

Permalink
Ensure kind_version is set on transparency log entries after signing (#…
Browse files Browse the repository at this point in the history
…214)

Signed-off-by: Samuel Giddins <segiddins@segiddins.me>
  • Loading branch information
segiddins authored Feb 13, 2025
1 parent 76eeb3d commit 345b2a2
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/sigstore/rekor/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,17 @@ def self.decode_transparency_log_entry(response)
raise ArgumentError, "Received multiple entries in response" if response.size != 1

_, result = response.first
canonicalized_body = Internal::Util.base64_decode(result.fetch("body"))
body = JSON.parse(canonicalized_body)
entry = V1::TransparencyLogEntry.new
entry.canonicalized_body = Internal::Util.base64_decode(result.fetch("body"))
entry.integrated_time = result.fetch("integratedTime")
entry.log_index = result.fetch("logIndex")
entry.log_id = Common::V1::LogId.new
entry.log_id.key_id = Internal::Util.hex_decode(result.fetch("logID"))
entry.log_index = result.fetch("logIndex")
entry.kind_version = V1::KindVersion.new
entry.kind_version.kind = body.fetch("kind")
entry.kind_version.version = body.fetch("apiVersion")
entry.integrated_time = result.fetch("integratedTime")
entry.canonicalized_body = canonicalized_body
if (set = result.dig("verification", "signedEntryTimestamp"))
entry.inclusion_promise = V1::InclusionPromise.new
entry.inclusion_promise.signed_entry_timestamp = Internal::Util.base64_decode(set)
Expand Down

0 comments on commit 345b2a2

Please sign in to comment.