Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
c50725fe
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c50725fe
编写于
9月 29, 2017
作者:
R
Rubén Dávila
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Address feedback from last code review
上级
c2c35ae7
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
16 addition
and
16 deletion
+16
-16
app/models/gpg_key.rb
app/models/gpg_key.rb
+5
-0
app/models/gpg_key_subkey.rb
app/models/gpg_key_subkey.rb
+3
-0
app/models/gpg_signature.rb
app/models/gpg_signature.rb
+1
-1
lib/gitlab/gpg.rb
lib/gitlab/gpg.rb
+5
-6
lib/gitlab/gpg/commit.rb
lib/gitlab/gpg/commit.rb
+1
-7
lib/gitlab/gpg/invalid_gpg_signature_updater.rb
lib/gitlab/gpg/invalid_gpg_signature_updater.rb
+1
-2
未找到文件。
app/models/gpg_key.rb
浏览文件 @
c50725fe
...
...
@@ -44,6 +44,7 @@ class GpgKey < ActiveRecord::Base
def
primary_keyid
super
&
.
upcase
end
alias_method
:keyid
,
:primary_keyid
def
fingerprint
super
&
.
upcase
...
...
@@ -53,6 +54,10 @@ class GpgKey < ActiveRecord::Base
super
(
value
&
.
strip
)
end
def
keyids
[
keyid
].
concat
(
subkeys
.
map
(
&
:keyid
))
end
def
user_infos
@user_infos
||=
Gitlab
::
Gpg
.
user_infos_from_key
(
key
)
end
...
...
app/models/gpg_key_subkey.rb
浏览文件 @
c50725fe
...
...
@@ -9,6 +9,9 @@ class GpgKeySubkey < ActiveRecord::Base
validates
:gpg_key_id
,
presence:
true
validates
:fingerprint
,
:keyid
,
presence:
true
,
uniqueness:
true
delegate
:key
,
:user
,
:user_infos
,
:verified?
,
:verified_user_infos
,
:verified_and_belongs_to_email?
,
to: :gpg_key
def
keyid
super
&
.
upcase
end
...
...
app/models/gpg_signature.rb
浏览文件 @
c50725fe
...
...
@@ -24,7 +24,7 @@ class GpgSignature < ActiveRecord::Base
def
gpg_key
=
(
model
)
case
model
when
GpgKey
then
super
when
GpgKeySubkey
then
write_attribute
(
:gpg_key_subkey_id
,
model
.
id
)
when
GpgKeySubkey
then
self
.
gpg_key_subkey
=
model
end
end
...
...
lib/gitlab/gpg.rb
浏览文件 @
c50725fe
...
...
@@ -38,13 +38,12 @@ module Gitlab
using_tmp_keychain
do
fingerprints
=
CurrentKeyChain
.
fingerprints_from_key
(
key
)
raw_keys
=
GPGME
::
Key
.
find
(
:public
,
fingerprints
)
grouped_subkeys
=
Hash
.
new
{
|
h
,
k
|
h
[
k
]
=
[]
}
raw_keys
.
each_with_object
(
grouped_subkeys
).
each
do
|
raw_key
,
subkeys
|
raw_keys
.
each_with_object
(
{})
do
|
raw_key
,
grouped_
subkeys
|
primary_subkey_id
=
raw_key
.
primary_subkey
.
keyid
raw_key
.
subkeys
[
1
..-
1
].
each
do
|
subkey
|
subkeys
[
primary_subkey_id
]
<<
{
keyid:
subkey
.
keyid
,
fingerprint:
subkey
.
fingerprint
}
grouped_subkeys
[
primary_subkey_id
]
=
raw_key
.
subkeys
[
1
..-
1
].
map
do
|
s
|
{
keyid:
s
.
keyid
,
fingerprint:
s
.
fingerprint
}
end
end
end
...
...
lib/gitlab/gpg/commit.rb
浏览文件 @
c50725fe
...
...
@@ -74,7 +74,7 @@ module Gitlab
commit_sha:
@commit
.
sha
,
project:
@commit
.
project
,
gpg_key:
gpg_key
,
gpg_key_primary_keyid:
gpg_key
id
(
gpg_key
)
||
verified_signature
.
fingerprint
,
gpg_key_primary_keyid:
gpg_key
&
.
keyid
||
verified_signature
.
fingerprint
,
gpg_key_user_name:
user_infos
[
:name
],
gpg_key_user_email:
user_infos
[
:email
],
verification_status:
verification_status
...
...
@@ -99,12 +99,6 @@ module Gitlab
gpg_key
&
.
verified_user_infos
&
.
first
||
gpg_key
&
.
user_infos
&
.
first
||
{}
end
def
gpg_keyid
(
gpg_key
)
return
nil
unless
gpg_key
gpg_key
.
is_a?
(
GpgKey
)
?
gpg_key
.
primary_keyid
:
gpg_key
.
keyid
end
def
find_gpg_key
(
keyid
)
GpgKey
.
find_by
(
primary_keyid:
keyid
)
||
GpgKeySubkey
.
find_by
(
keyid:
keyid
)
end
...
...
lib/gitlab/gpg/invalid_gpg_signature_updater.rb
浏览文件 @
c50725fe
...
...
@@ -3,14 +3,13 @@ module Gitlab
class
InvalidGpgSignatureUpdater
def
initialize
(
gpg_key
)
@gpg_key
=
gpg_key
@gpg_keyids
=
gpg_key
.
subkeys
.
map
(
&
:keyid
).
push
(
gpg_key
.
primary_keyid
)
end
def
run
GpgSignature
.
select
(
:id
,
:commit_sha
,
:project_id
)
.
where
(
'gpg_key_id IS NULL OR verification_status <> ?'
,
GpgSignature
.
verification_statuses
[
:verified
])
.
where
(
gpg_key_primary_keyid:
@gpg_keyids
)
.
where
(
gpg_key_primary_keyid:
@gpg_key
.
key
ids
)
.
find_each
{
|
sig
|
sig
.
gpg_commit
.
update_signature!
(
sig
)
}
end
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录