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:
authorAlexis Reigel <mail@koffeinfrei.org>2017-08-24 15:21:26 +0300
committerAlexis Reigel <mail@koffeinfrei.org>2017-09-05 13:18:31 +0300
commit508ff17b3405a4e2275fa137bd7322b728db8ed4 (patch)
tree7e00cb57f432d92b4a6af349678efe54bb2546cb /lib/gitlab/gpg
parentff413ec28d5f0721646cea223fb5e5a054bde31e (diff)
pass whole commit to Gitlab::Gpg::Commit again
we need the commit object for the updated verification that also checks the committer's email to match the gpg key and user's emails.
Diffstat (limited to 'lib/gitlab/gpg')
-rw-r--r--lib/gitlab/gpg/commit.rb17
1 files changed, 6 insertions, 11 deletions
diff --git a/lib/gitlab/gpg/commit.rb b/lib/gitlab/gpg/commit.rb
index 606c7576f70..f701897955b 100644
--- a/lib/gitlab/gpg/commit.rb
+++ b/lib/gitlab/gpg/commit.rb
@@ -1,17 +1,12 @@
module Gitlab
module Gpg
class Commit
- def self.for_commit(commit)
- new(commit.project, commit.sha)
- end
-
- def initialize(project, sha)
- @project = project
- @sha = sha
+ def initialize(commit)
+ @commit = commit
@signature_text, @signed_text =
begin
- Rugged::Commit.extract_signature(project.repository.rugged, sha)
+ Rugged::Commit.extract_signature(@commit.project.repository.rugged, @commit.sha)
rescue Rugged::OdbError
nil
end
@@ -26,7 +21,7 @@ module Gitlab
return @signature if @signature
- cached_signature = GpgSignature.find_by(commit_sha: @sha)
+ cached_signature = GpgSignature.find_by(commit_sha: @commit.sha)
return @signature = cached_signature if cached_signature.present?
@signature = create_cached_signature!
@@ -75,8 +70,8 @@ module Gitlab
user_infos = user_infos(gpg_key)
{
- commit_sha: @sha,
- project: @project,
+ commit_sha: @commit.sha,
+ project: @commit.project,
gpg_key: gpg_key,
gpg_key_primary_keyid: gpg_key&.primary_keyid || verified_signature.fingerprint,
gpg_key_user_name: user_infos[:name],