2020-03-13 15:44:24 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
require 'openssl'
|
|
|
|
require 'digest'
|
|
|
|
|
|
|
|
module Gitlab
|
|
|
|
module X509
|
|
|
|
class Commit < Gitlab::SignedCommit
|
|
|
|
private
|
|
|
|
|
2022-08-13 15:12:31 +05:30
|
|
|
def signature_class
|
|
|
|
CommitSignatures::X509CommitSignature
|
2020-03-13 15:44:24 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
def attributes
|
2020-04-22 19:07:51 +05:30
|
|
|
return if @commit.sha.nil? || @commit.project.nil?
|
2020-03-13 15:44:24 +05:30
|
|
|
|
2020-04-22 19:07:51 +05:30
|
|
|
signature = X509::Signature.new(signature_text, signed_text, @commit.committer_email, @commit.created_at)
|
|
|
|
|
|
|
|
return if signature.verified_signature.nil? || signature.x509_certificate.nil?
|
2020-03-13 15:44:24 +05:30
|
|
|
|
|
|
|
{
|
|
|
|
commit_sha: @commit.sha,
|
|
|
|
project: @commit.project,
|
2020-04-22 19:07:51 +05:30
|
|
|
x509_certificate_id: signature.x509_certificate.id,
|
|
|
|
verification_status: signature.verification_status
|
2020-03-13 15:44:24 +05:30
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|