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
Boxiang Sun
gitlab-ce
Commits
2577cc99
Commit
2577cc99
authored
Oct 04, 2017
by
Rubén Dávila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Address some feedback from last code review
parent
8be06f20
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
15 additions
and
6 deletions
+15
-6
app/models/gpg_signature.rb
app/models/gpg_signature.rb
+7
-2
changelogs/unreleased/36829-add-ability-to-verify-gpg-subkeys.yml
...gs/unreleased/36829-add-ability-to-verify-gpg-subkeys.yml
+0
-0
db/migrate/20170927161718_create_gpg_key_subkeys.rb
db/migrate/20170927161718_create_gpg_key_subkeys.rb
+2
-2
db/post_migrate/20171002161539_create_gpg_key_subkeys_for_existing_gpg_keys.rb
...002161539_create_gpg_key_subkeys_for_existing_gpg_keys.rb
+3
-1
db/schema.rb
db/schema.rb
+1
-1
lib/gitlab/gpg/commit.rb
lib/gitlab/gpg/commit.rb
+2
-0
No files found.
app/models/gpg_signature.rb
View file @
2577cc99
...
...
@@ -23,8 +23,13 @@ class GpgSignature < ActiveRecord::Base
def
gpg_key
=
(
model
)
case
model
when
GpgKey
then
super
when
GpgKeySubkey
then
self
.
gpg_key_subkey
=
model
when
GpgKey
super
when
GpgKeySubkey
self
.
gpg_key_subkey
=
model
when
NilClass
super
self
.
gpg_key_subkey
=
nil
end
end
...
...
changelogs/unreleased/36829-add-ability-to-verify-gpg-subkeys
→
changelogs/unreleased/36829-add-ability-to-verify-gpg-subkeys
.yml
View file @
2577cc99
File moved
db/migrate/20170927161718_create_gpg_key_subkeys.rb
View file @
2577cc99
...
...
@@ -3,11 +3,11 @@ class CreateGpgKeySubkeys < ActiveRecord::Migration
def
up
create_table
:gpg_key_subkeys
do
|
t
|
t
.
references
:gpg_key
,
null:
false
,
index:
true
,
foreign_key:
{
on_delete: :cascade
}
t
.
binary
:keyid
t
.
binary
:fingerprint
t
.
references
:gpg_key
,
null:
false
,
index:
true
,
foreign_key:
{
on_delete: :cascade
}
t
.
index
:keyid
,
unique:
true
,
length:
Gitlab
::
Database
.
mysql?
?
20
:
nil
t
.
index
:fingerprint
,
unique:
true
,
length:
Gitlab
::
Database
.
mysql?
?
20
:
nil
end
...
...
db/post_migrate/20171002161539_create_gpg_key_subkeys_for_existing_gpg_keys.rb
View file @
2577cc99
...
...
@@ -28,8 +28,10 @@ class CreateGpgKeySubkeysForExistingGpgKeys < ActiveRecord::Migration
end
def
up
GpgKey
.
each_batch
do
|
batch
|
GpgKey
.
with_subkeys
.
each_batch
do
|
batch
|
batch
.
each
do
|
gpg_key
|
return
if
gpg_key
.
subkeys
.
any?
create_subkeys
(
gpg_key
)
&&
update_signatures
(
gpg_key
)
end
end
...
...
db/schema.rb
View file @
2577cc99
...
...
@@ -580,9 +580,9 @@ ActiveRecord::Schema.define(version: 20171004121444) do
add_index
"forked_project_links"
,
[
"forked_to_project_id"
],
name:
"index_forked_project_links_on_forked_to_project_id"
,
unique:
true
,
using: :btree
create_table
"gpg_key_subkeys"
,
force: :cascade
do
|
t
|
t
.
integer
"gpg_key_id"
,
null:
false
t
.
binary
"keyid"
t
.
binary
"fingerprint"
t
.
integer
"gpg_key_id"
,
null:
false
end
add_index
"gpg_key_subkeys"
,
[
"fingerprint"
],
name:
"index_gpg_key_subkeys_on_fingerprint"
,
unique:
true
,
using: :btree
...
...
lib/gitlab/gpg/commit.rb
View file @
2577cc99
...
...
@@ -43,6 +43,8 @@ module Gitlab
# key belonging to the keyid.
# This way we can add the key to the temporary keychain and extract
# the proper signature.
# NOTE: the invoked method is #fingerprint but it's only returning
# 16 characters (the format used by keyid) instead of 40.
gpg_key
=
find_gpg_key
(
verified_signature
.
fingerprint
)
if
gpg_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