Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-08-10 12:10:08 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-08-10 12:10:08 +0300
commit5adf6557e251c047ed68bac28cfecf9491ee6b41 (patch)
treea7ea2924ef96ccf36a915ddaf686f5f6e1e75b00 /lib/gitlab/x509
parent0adc81d8e0c7b291fd7fdef33a4ea9c01b4852ce (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/x509')
-rw-r--r--lib/gitlab/x509/tag.rb33
1 files changed, 6 insertions, 27 deletions
diff --git a/lib/gitlab/x509/tag.rb b/lib/gitlab/x509/tag.rb
index ad85b200130..cf24e6f62bd 100644
--- a/lib/gitlab/x509/tag.rb
+++ b/lib/gitlab/x509/tag.rb
@@ -4,37 +4,16 @@ require 'digest'
module Gitlab
module X509
- class Tag
+ class Tag < Gitlab::SignedTag
include Gitlab::Utils::StrongMemoize
- def initialize(raw_tag)
- @raw_tag = raw_tag
- end
-
def signature
- signature = X509::Signature.new(signature_text, signed_text, @raw_tag.tagger.email, Time.at(@raw_tag.tagger.date.seconds))
-
- return if signature.verified_signature.nil?
-
- signature
- end
-
- private
-
- def signature_text
- @raw_tag.message.slice(@raw_tag.message.index("-----BEGIN SIGNED MESSAGE-----")..-1)
- rescue StandardError
- nil
- end
-
- def signed_text
- # signed text is reconstructed as long as there is no specific gitaly function
- %{object #{@raw_tag.target_commit.id}
-type commit
-tag #{@raw_tag.name}
-tagger #{@raw_tag.tagger.name} <#{@raw_tag.tagger.email}> #{@raw_tag.tagger.date.seconds} #{@raw_tag.tagger.timezone}
+ strong_memoize(:signature) do
+ super
-#{@raw_tag.message.gsub(/-----BEGIN SIGNED MESSAGE-----(.*)-----END SIGNED MESSAGE-----/m, "")}}
+ signature = X509::Signature.new(signature_text, signed_text, @tag.tagger.email, Time.at(@tag.tagger.date.seconds))
+ signature unless signature.verified_signature.nil?
+ end
end
end
end