Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
a41e7e01
Commit
a41e7e01
authored
Sep 27, 2017
by
Rubén Dávila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add ability to include subkeys when finding by fingerprint
parent
d0572d9a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
1 deletion
+12
-1
app/models/gpg_key.rb
app/models/gpg_key.rb
+11
-0
lib/gitlab/gpg/commit.rb
lib/gitlab/gpg/commit.rb
+1
-1
No files found.
app/models/gpg_key.rb
View file @
a41e7e01
...
@@ -40,6 +40,17 @@ class GpgKey < ActiveRecord::Base
...
@@ -40,6 +40,17 @@ class GpgKey < ActiveRecord::Base
after_commit
:update_invalid_gpg_signatures
,
on: :create
after_commit
:update_invalid_gpg_signatures
,
on: :create
after_create
:generate_subkeys
after_create
:generate_subkeys
def
self
.
find_with_subkeys
(
fingerprint
)
keys_table
=
arel_table
subkeys_table
=
GpgKeySubkey
.
arel_table
condition
=
keys_table
[
:primary_keyid
].
eq
(
fingerprint
).
or
(
subkeys_table
[
:keyid
].
eq
(
fingerprint
)
)
joins
(
:subkeys
).
where
(
condition
).
first
end
def
primary_keyid
def
primary_keyid
super
&
.
upcase
super
&
.
upcase
end
end
...
...
lib/gitlab/gpg/commit.rb
View file @
a41e7e01
...
@@ -43,7 +43,7 @@ module Gitlab
...
@@ -43,7 +43,7 @@ module Gitlab
# key belonging to the keyid.
# key belonging to the keyid.
# This way we can add the key to the temporary keychain and extract
# This way we can add the key to the temporary keychain and extract
# the proper signature.
# the proper signature.
gpg_key
=
GpgKey
.
find_
by
(
primary_keyid:
verified_signature
.
fingerprint
)
gpg_key
=
GpgKey
.
find_
with_subkeys
(
verified_signature
.
fingerprint
)
if
gpg_key
if
gpg_key
Gitlab
::
Gpg
::
CurrentKeyChain
.
add
(
gpg_key
.
key
)
Gitlab
::
Gpg
::
CurrentKeyChain
.
add
(
gpg_key
.
key
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment